Reactolith UI Getting Started Introduction Installation Usage Layout Aspect Ratio Card Resizable Scroll Area Separator Direction Provider Forms Button Button Group Calendar Checkbox Combobox Field Input Input Group Input OTP Label Native Select Radio Group Select Slider Switch Textarea Toggle Toggle Group Data Display Accordion Avatar Badge Carousel Chart Collapsible Item Kbd Table Feedback Alert Empty Progress Skeleton Sonner Spinner Overlay Alert Dialog Context Menu Dialog Dropdown Menu Hover Card Popover Sheet Tooltip Navigation Breadcrumb Command Menubar Navigation Menu Pagination Sidebar Tabs

Switch

A control that allows the user to toggle between two states.

Preview

Airplane Mode
Notifications (on)
Disabled

Usage

<div class="space-y-4">
  <div class="flex items-center gap-3">
    <ui-switch id="airplane-mode"></ui-switch>
    <ui-label for="airplane-mode">Airplane Mode</ui-label>
  </div>
  <div class="flex items-center gap-3">
    <ui-switch defaultChecked></ui-switch>
    <ui-label>Notifications (on)</ui-label>
  </div>
  <div class="flex items-center gap-3">
    <ui-switch disabled></ui-switch>
    <ui-label>Disabled</ui-label>
  </div>
</div>

Sub-components

<ui-switch>

Props

<ui-switch>

PropTypeDefaultDescription
checkedbooleanControlled checked state.
defaultCheckedbooleanfalseDefault checked state.
disabledbooleanfalseWhether disabled.

All components also accept standard HTML attributes (class, id, style, data-*, aria-*, etc.) which are passed through to the underlying element.