Simulates prefers-reduced-motion for the demo. Off follows your system setting.
Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.
1
An on and off switch whose thumb stretches as it travels.
npx shadcn@latest add ikislay/pixel-ui/switchimport { Switch } from "@/components/ui/switch"export function Demo() {return (<label className="flex items-center gap-3"><Switch defaultChecked />Airplane mode</label>)}
1// Loading…
Options you can pass to customize this component.
checkedbooleanControls the state. Leave it unset to let the switch manage itself.
defaultCheckedbooleanThe starting state when uncontrolled.
onCheckedChange(checked: boolean) => voidCalled with the new state.
onFeedback(event: "toggle") => voidCalled at each semantic moment, for wiring sound or haptics.
classNamestringMerged onto the root element.