Pilipinas Interface

Foundation

  • Overview
  • Get Started
  • Colors
  • Typography
  • Icons
  • Layout & Spacing
  • States & Feedback
  • Motion & Transitions
  • Expressions

Components

  • Overview
  • Accordion
  • Alert
  • Avatar
  • Badge
  • Banner
  • Breadcrumb
  • Button
  • Card
  • Checkbox
  • Code Block
  • Combobox
  • Command Menu
  • Dialog
  • Popover
  • Progress
  • Radio Group
  • Scroll Area
  • Select
  • Skeleton
  • Switch
  • Table
  • Tabs
  • Text Field
  • Tooltip

Resources

  • Registry

Components

Switch

Boolean preferences that take effect immediately. The thumb settles on a spring and can be dragged past its midpoint to commit or abandon.

Preview
Receive the barangay newsletter
Require accessibility-statement acknowledgement on submission
<Switch
  label="Email updates"
  checked={enabled}
  onToggle={() => setEnabled(!enabled)}
/>

Usage

A boolean preference that takes effect as soon as it changes.

Do and don't

  • Do. Keep the label steady and name the setting, not the action.
  • Don't. Use it for a form tick that only matters on submit.

Props

  • checked + onToggle(); controlled, the caller flips state.
  • label; required string, rendered beside the switch and announced with it.
  • disabled, thumbTransition, size="default" | "compact".

Related

The on state uses the active accent token, so it follows the site-wide accent preference without a component change.

← PreviousSkeletonNext →Table

Install

npx shadcn@latest add @pilipinas/switch

For your coding agent