Switch
Binary on/off toggle with controlled and uncontrolled modes.
At a glance
- Renders with
role="switch"on web; maps to RN<Switch>on native. - Controlled via
checkedor uncontrolled viadefaultChecked.
Web preview
Native preview
Props
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | — | Controlled value |
defaultChecked | boolean | false | Uncontrolled initial value |
onCheckedChange | (checked: boolean) => void | — | Change handler |
disabled | boolean | false | Disables interaction |
label | string | — | Visible label tied via aria |
asChild | boolean | false | Renders the supplied child as root |