edbnedbn/ui
Get Started
WelcomeWhy We're DifferentChoosing a VariantChangelogLicense
Components
OverviewAlert DialogCheckboxCollapsibleDialogFieldInputMenuNumber FieldPopoverProgressRadioScroll AreaSelectSeparatorSliderSwitch
TabsToggleTooltip
Shared Components
InputTextareaCardAvatarTableAlertBreadcrumbPagination
0installs
Components
Maps
GitHub stars
HomeDocsComponentsStaticSwitch

On this page

Switch

A toggle switch for on/off states. Built on Base UI Switch primitives.

Airplane Mode

Usage

import { SwitchRoot, SwitchThumb } from "@/components/ui/static/switch"
<SwitchRoot>
  <SwitchThumb />
</SwitchRoot>

Installation

Install dependencies

TypeScript
npm install @base-ui/react

Examples

With Label

Notifications

Receive push notifications

Disabled

Disabled switch

API Reference

checkedboolean

Controlled checked state.

onCheckedChange(checked: boolean) => void

Callback when checked state changes.

defaultCheckedboolean

Default checked state for uncontrolled usage.

disabledboolean

Whether the switch is disabled.