Switch

Toggle switch for boolean preferences. Supports label, description, and disabled.

Live Demo

Enable experimental features. May be unstable.

Props

PropTypeDefaultDescription
labelstringcomponentPages.switch_prop_label
descriptionstringcomponentPages.switch_prop_description
checkedbooleancomponentPages.switch_prop_checked
onCheckedChange(checked: boolean) => voidcomponentPages.switch_prop_onCheckedChange
disabledbooleanfalsecomponentPages.switch_prop_disabled
idstringcomponentPages.switch_prop_id

Usage

import { Switch } from '@ghiberti85/ui'

// Basic
<Switch id="darkMode" label="Dark mode" />

// With description
<Switch
  id="beta"
  label="Beta features"
  description="Enable experimental features. May be unstable."
/>

// Controlled
<Switch
  id="notif"
  label="Notifications"
  checked={enabled}
  onCheckedChange={setEnabled}
/>

// Disabled
<Switch id="airplane" label="Airplane mode" disabled />

View in Storybook

Open in Storybook
Ghiberti UI — Design System