Forms
Switch
On/off toggle.
import { Switch } from "datui";Playground
<Switch aria-label="Notifications" />Examples
States
Accessibility
- Radix Switch:
role="switch"witharia-checked; Space and Enter toggle. - Label it with
<label htmlFor>oraria-label. readOnlysetsaria-readonlyand ignores toggles.
API
Switch
On/off toggle (Radix Switch, `role="switch"`). Space and Enter toggle. Needs a label.
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | — | |
| className | string | — | |
| defaultChecked | boolean | — | |
| name | string | — | |
| onCheckedChange | ((checked: boolean) => void) | — | |
| readOnly | boolean | — | Focusable and announced, but toggling is blocked. |
| required | boolean | — | |
| value | string | — |