On this page:

Switch

Preview

index.tsx

Preview

index.tsx

Preview

index.tsx

Design Tokens for Switch

TokenColor forState/Meaning
--par-color-bg-switch-target-handleSwitch thumb backgroundEnabled
--par-color-bg-switch-target-handle-disabledSwitch thumb backgroundDisabled
--par-color-bg-switch-target-track-uncheckSwitch track backgroundUnchecked
--par-color-bg-switch-target-track-uncheck-disabledSwitch track backgroundUnchecked Disabled
--par-color-bg-switch-target-track-checkSwitch track backgroundChecked
--par-color-bg-switch-target-track-check-disabledSwitch track backgroundChecked Disabled
--par-color-border-switch-uncheckedSwitch borderUnchecked
--par-color-border-switch-checkedSwitch borderChecked
--par-color-border-switch-unchecked-disabledSwitch borderUnchecked Disabled
--par-color-border-switch-checked-disabledSwitch borderChecked Disabled
--par-color-text-switch-target-unchecked-enabledSwitch iconUnchecked
--par-color-text-switch-target-checked-enabledSwitch iconChecked
--par-color-text-switch-target-unchecked-disabledSwitch iconUnchecked Disabled
--par-color-text-switch-target-checked-disabledSwitch iconChecked Disabled

Switch API Reference

<Switch />

PropTypeDefaultDescription
activebooleanControlled state
defaultActivebooleanfalseUncontrolled initial state
switchSize'sm' | 'md' | 'lg''md'Switch size
disabledbooleanfalseDisable the switch
iconbooleanfalseShow icon on thumb
onTogglefunction (active: boolean)Callback when value changes
...buttonPropsSee MDNInherits all props from native button

Note: Switch does not inherit Input props. See Button documentation for full details on available props.