uimaxxer

Switch

Tap it, or grab the thumb and drag. It follows your finger, stretches as you press, and a flick decides.

npx shadcn@latest add https://uimaxxer.com/r/switch.json
PasskeysSettings · Permissions

Permissions

Swarm on #482

Four agents fixing duplicate Stripe charges, $40.00 cap

Run tests before every push

Agents push without running the suite.

Ask before merging into main

Agents merge as soon as every check passes.

Stop at the spend cap

All four agents pause at $40.00 for this run.

Usage

import { Switch } from "@/components/ui/switch"

<Switch label="Ask before merging" onCheckedChange={setAsk} />

Props

PropTypeDefaultWhat it does
checkedbooleanControlled state.
defaultCheckedbooleanfalseInitial state when uncontrolled.
onCheckedChange(checked: boolean) => voidCalled on tap, drag release or keyboard.
labelReactNodeVisible label; clicking it toggles too.
size"sm" | "md" | "lg""md"36×22, 46×28 or 60×36. The hit area is always at least 44px.
disabledbooleanDims and ignores input.

Keyboard

Space
Toggle
Enter
Toggle

Accessibility

  • role=switch with aria-checked.
  • The label is wired with aria-labelledby.
  • Dragging is optional: tap and keyboard do the same thing.