GitHubnpm

Accent theme

Base radius

GitHubnpm

Accent theme

Base radius

Colour scheme

Docs menu

Guides


Primitives
Forms
Layout
Feedback
Overlays
Navigation
Data Display
AI

Switch

There's no native switch element yet, so this follows the WAI-ARIA switch pattern: a real <button role="switch">, which gets click, Space/Enter, and focus for free, with aria-checked telling assistive tech it's a two-state toggle rather than a regular button.

Playground

Toggle every adjustable prop and watch the component — and the code — update live.

Unstyled

Same component — Kernel look stripped. See Platforms.

checked
disabled
Usage
<Switch>Enable notifications</Switch>

Props

Props for Switch.
PropTypeDefault
checked / defaultCheckedbooleanfalse
onCheckedChange(checked: boolean) => void

Accessibility

Wrapping it with label text works because <button> is a labelable element, exactly like <input>, so clicking the text toggles the switch without any extra click handler.