Search
Search components and blocks
Switch
The shadcn Switch with a spring-driven thumb instead of a CSS transition, for a snappier, slightly bouncy toggle — plus a press-down squish on tap and a smoother track color fade.
Install
$ pnpm dlx shadcn@latest add @ditherui/switch
Props
PropTypeDefault
checkedboolean—defaultCheckedbooleanfalseonCheckedChange(checked: boolean) => void—size"sm" | "default""default"disabledbooleanfalseWhen to use the switch
Use switches for settings that take effect immediately. It is the shadcn Switch with a spring-driven thumb.
Open the CLI tab on any preview above for the exact shadcn command. The source is copied into your project, so you can edit it like any other file.