Switch
Formv1.0.0
stable
A toggle switch component for binary choices.
Preview
npx inam-ui add switchUsage Examples
Settings Toggle
Use for binary on/off settings
<Switch
label="Enable Notifications"
checked={enabled}
onChange={setEnabled}
/>Accessibility
Keyboard Navigation
- •Space or Enter - Toggle switch state
- •Tab - Move focus
ARIA Labels
role='switch'aria-checked
Screen Reader
Announces as 'switch' with label and state.
Props
| Name | Type | Default | Description |
|---|---|---|---|
label | string | — | Label text for the switch. |
checked | boolean | false | Whether the switch is on. |
disabled | boolean | false | Whether the switch is disabled. |
onChange | (checked: boolean) => void | — | Callback when switch state changes. |