Switch
A tactile toggle for settings that take effect immediately.
npx shadcn@latest add @silicon-ui/switchInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/switchManually
Install the dependencies
npm install @radix-ui/react-switch motionCopy these files into your project
- components/silicon-ui/switch/switch.tsx
- components/silicon-ui/switch/switch.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
label | string | — |
Also accepts the props of ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>.