Switch

A toggle control that switches between on and off.

The Switch toggles a setting on or off. Built on Radix UI with full keyboard support.

Preview

Usage

Installation

$ npx shadcn@latest add https://spark-ui-olive.vercel.app/r/switch.json

Properties

PropTypeDefaultDescription
checkedbooleanControlled checked state.
onCheckedChange(checked: boolean) => voidCalled when the checked state changes.
disabledbooleanfalseDisables the switch.
classNamestringAdditional CSS classes.