Switch
Toggle switch in three sizes with optional label and description following the ARIA switch pattern.
Copy a prompt for your AI coding tool with the source, dependencies and usage
Props
SwitchProps
Also accepts all props of Omit<React.ComponentProps<"button">, "onChange" | "role">
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | — | — |
| defaultChecked | boolean | false | — |
| onCheckedChange | (checked: boolean) => void | — | — |
| size | keyof typeof sizes | "md" | — |
| label | React.ReactNode | — | Visible label rendered next to the switch |
| description | React.ReactNode | — | — |
Install
$ npx shadcn@latest add https://chromotion.dev/r/switch.json