Default

<Switch label="Enable notifications" />

States

<Switch label="Default (off)" />
<Switch label="Checked (on)" checked />
<Switch label="Disabled" disabled />
<Switch label="Disabled on" disabled checked />

With description and error

Changes the color scheme to dark.

This feature is not available on your plan.

<Switch
  label="Dark mode"
  description="Changes the color scheme to dark."
/>
<Switch
  label="Experimental feature"
  error="This feature is not available on your plan."
/>

Sizes

<Switch size="xs" label="xs" />
<Switch size="sm" label="sm" />
<Switch size="md" label="md" />
<Switch size="lg" label="lg" />
<Switch size="xl" label="xl" />

Colors

<Switch label="Blue" color="blue" checked />
<Switch label="Green" color="green" checked />

Props

PropTypeDefaultDescription
idstringAssociates label with switch via HTML for/id
labelReactNodeClickable label beside the switch track
descriptionReactNodeHelper text below the label
errorReactNode|booleanError message; pass true for styles only
checkedbooleanOn/checked state (SSR snapshot)
defaultCheckedbooleanOn by default without controlling subsequent state
disabledbooleanDisables the switch
requiredbooleanMarks the underlying checkbox as required
size'xs'|'sm'|'md'|'lg'|'xl'Controls the overall size of the switch
radius'xs'|'sm'|'md'|'lg'|'xl'|stringBorder-radius of the track
colorstringFill color of the track when on
labelPosition'right'|'left''right'Side on which the label is placed
namestringForm field name
valuestringValue submitted when the switch is on
classstringAdditional CSS class names
styleobjectInline styles