Skip to content

Switch

A control that allows the user to toggle between checked and not checked.

Examples

Default

vue
<div class="flex items-center space-x-2">
  <Switch id="airplane-mode" />
  <Label for="airplane-mode">Airplane Mode</Label>
</div>

Props

Switch

PropTypeDefaultDescription
checkedboolean-The controlled checked state of the switch.
defaultCheckedbooleanfalseThe checked state of the switch when it is initially rendered.
disabledbooleanfalseWhether the switch is disabled.
requiredbooleanfalseWhether the switch is required.
namestring-The name of the switch.
valuestring'on'The value of the switch.
idstring-The id of the switch.

Slots

Switch

SlotDescription
thumbThe thumb content.