← All Components

Switch

Binary toggle for on/off settings. Built on Radix Switch.

Default

Initially Checked

Form Example

Use dark theme across the app

Receive email notifications

Receive text messages

Disabled

Props

PropTypeDescription
checkedbooleanControlled checked state
defaultCheckedbooleanInitial checked state
onCheckedChange(checked: boolean) => voidChange handler
disabledbooleanDisable interaction
classNamestringAdditional classes

Usage

<Switch id="airplane" /> <Label htmlFor="airplane">Airplane Mode</Label> <Switch defaultChecked /> <Switch disabled />