Search

Search components and blocks

Sign in

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.

pnpm dlx shadcn@latest add @ditherui/switch

Install

$ pnpm dlx shadcn@latest add @ditherui/switch

Props

checkedboolean—
defaultCheckedbooleanfalse
onCheckedChange(checked: boolean) => void—
size"sm" | "default""default"
disabledbooleanfalse

When 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.

Suggested components