Switch

A toggle control for binary on/off settings. Prefer Switch over Checkbox when the action takes effect immediately without requiring a form submit.

Examples

With label

With description

Sizes

Settings list

Disabled

Props

defaultChecked
boolean
Initial state (uncontrolled).
checked
boolean
Controlled checked state.
onCheckedChange
(checked: boolean) => void
Called when state changes.
size= 'md'
'sm' | 'md'
Track size.
label
string
Label text rendered next to the switch.
description
string
Secondary text below the label.
disabled
boolean
Prevents interaction.
id
string
Custom id for the input element.