Switch

A toggle with a raised thumb. Works with a keyboard and screen readers.

Install it the shadcn way: copy the source file into your project. It uses CSS 3D, Tailwind CSS v4 and Framer Motion, no WebGL.

Switch3D props

PropTypeDefaultDescription
checkedbooleanControlled on/off state.
defaultCheckedbooleanfalseInitial on/off state when uncontrolled.
onCheckedChange(checked: boolean) => voidCalled with the new on/off state whenever it changes.
disabledbooleanStops the user from toggling the switch.
labelReactNodeVisible label. Clicking it toggles the switch.
aria-labelstringRequired when there is no visible label.
classNamestringExtra classes added to the outer element.

More components

Guides

Start

Cards

Scenes

Controls & text

Buttons

More cards

UI elements

Form controls

App components

Text & backgrounds

Showpieces

Blocks