A toggle with a raised thumb. Works with a keyboard and screen readers.
Install it the shadcn way: copy the source file into your project. It uses CSS 3D, Tailwind CSS v4 and Framer Motion, no WebGL.
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | Controlled on/off state. | |
| defaultChecked | boolean | false | Initial on/off state when uncontrolled. |
| onCheckedChange | (checked: boolean) => void | Called with the new on/off state whenever it changes. | |
| disabled | boolean | Stops the user from toggling the switch. | |
| label | ReactNode | Visible label. Clicking it toggles the switch. | |
| aria-label | string | Required when there is no visible label. | |
| className | string | Extra classes added to the outer element. |