Switch
On/off toggle with a visible label.
Install this component
Install command hidden until you are signed in with a license.
Live demo
Email notifications
Currently on.
Props
| Prop | Type | Description |
|---|---|---|
| label | string | Visible label (required). |
| checked | boolean | Controlled value. |
| defaultChecked | booleandefault false | Initial value when uncontrolled. |
| onCheckedChange | (checked: boolean) => void | Change callback. |
Accessibility
Keyboard
- Space / EnterToggle
ARIA and semantics
- Button with role=switch and aria-checked
- aria-labelledby points to the visible label
Source
Copy the files into your project. Or install with the commands above (they unlock with your license).
The full Switch source is part of the license.
The live demo is free to try. A license unlocks copy-paste source, installs and exports for every component and pack.
Unlock every icon