Skip to Content

Switch

A toggle control for turning settings or features on and off. Built on Base UI Switch  for accessibility.

Unlike Checkbox, Switch is for changes that take effect immediately. It fits cases where settings are applied without a separate save action.

Preview

Examples

Intent

Controls the color intent of the switch track. Affects the color shown when the switch is on.

ValueDefaultDescription
primaryGeneral setting toggles.
secondarySecondary settings.
successWhen activation has a positive meaning.
warningWhen activation requires caution.
dangerWhen activation indicates a risky action.
neutralNeutral toggles.

Size

Controls the switch size.

ValueDefaultDescription
smallFor dense setting lists.
mediumGeneral settings screens.
largeWhen a larger click area is needed.
xlargeWhen a large touch target is needed (e.g. mobile).

Guidelines

Switch vs Checkbox

Use caseRecommended
On/off takes effect immediately (no save)Switch
Reflected on form submitCheckbox
Multiple selection from many optionsCheckbox
Single setting toggleSwitch

Accessibility

Always provide a label via the label prop so screen readers can identify the purpose of the switch.

Props

Props

Prop
Default
Type
size?
"medium"
"small" | "medium" | "large" | "xlarge"
intent?
"primary"
"primary" | "secondary" | "success" | "warning" | "danger" | "neutral"
label?
string
checked?
boolean
defaultChecked?
boolean
disabled?
false
boolean
onCheckedChange?
(checked: boolean) => void
name?
string
required?
boolean
readOnly?
boolean
Last updated on