Components/Forms
A toggle that powers on like a neon tube.
Turns off cellular, Wi-Fi and Bluetooth.
Connected to Studio 5G
Pauses downloads and background refresh until you charge.
Installation#
npx shadcn@latest add https://get-neonkit.vercel.app/r/switch.jsonUsage#
import { Switch } from "@/components/ui/switch"
<Switch label="Airplane mode" />Examples#
Sizes
Colors
Pass a palette name or any hex value to color.
Controlled
Pair checked with onCheckedChange to drive other UI from the state.
Only invited members can view this board.
API reference#
Switch
Renders a button with role="switch" and accepts its attributes; the ref points at the button. With a label, className and style go to the wrapper around both.
| Prop | Type | Default |
|---|---|---|
checked | booleanControlled on state. | — |
defaultChecked | booleanInitial state when uncontrolled. | false |
onCheckedChange | (checked: boolean) => voidCalled with the new state on every toggle. | — |
label | ReactNodeClickable label after the switch, linked with aria-labelledby. | — |
name | stringRenders a hidden input so the switch submits with a form when on. | — |
value | stringValue submitted under name. | "on" |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
size | "sm" | "md" | "lg"Track of 28, 36 or 44px wide. | "md" |
disabled | booleanBlocks interaction and dims the switch. | false |
Accessibility#
- Space and Enter toggle the switch, and aria-checked reports its state.
- Without a label, pass an aria-label or point a label element at the switch id.
- The power-on flicker is skipped when the user prefers reduced motion, and never plays for switches that are already on when they mount.