Skip to main content

Switch

A toggle switch for binary on/off states.

Basic Usage

Enable notifications

Variants

Primary
Secondary

Sizes

Small
Medium
Large

Disabled

Disabled off
Disabled on

Mobile considerations

  • Switch knob slides with the Pattern D layout-shift transition (var(--tui-duration-base) + var(--tui-ease-in-out)) — symmetric so on/off feel balanced.
  • Tap target is at minimum 44×44px on size="md" and "lg". For size="sm", embed inside a row that hits 44px on its own.
  • Switch is the right primitive for settings (instant apply). For form submission flows, use a Checkbox so changes are explicit on submit.

Props

PropTypeDefaultDescription
checkedboolean-Whether the switch is on (controlled)
defaultCheckedbooleanfalseInitial state (uncontrolled)
onChange(checked: boolean) => void-Callback when the switch is toggled
variant'primary' | 'secondary''primary'Color variant
size'sm' | 'md' | 'lg''md'Size of the switch
labelstring-Text label
requiredbooleanfalseWhether the field is required (shows red asterisk)
disabledbooleanfalseWhether the switch is disabled
classNamestring-Additional CSS class
styleCSSProperties-Inline styles