Switch
Inputs & Controls
macOS toggle switch with smooth pill sliding animation.
Installation
$npx shadcn-macos@latest add switch
Examples
Wi-Fi Enabled
Props
<Switch />| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | — | Controlled boolean toggle state. |
| defaultChecked | boolean | false | Initial toggle state when uncontrolled. |
| onCheckedChange | (checked: boolean) => void | — | Event handler fired when the switch toggle state changes. |
| disabled | boolean | false | Whether the switch cannot be toggled. |
| className | string | — | Custom styling classes. |