UIComponentsReact
A control that turns one setting on or off at once.
Built on the headless Switch.See its API in Docs
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/switch.jsonIt also adds utils. The app needs its setup first: Installation.
Usage
It is the headless Switch with a thumb; size="sm" makes it smaller. Name it with a Label pointing at its id.
import { Switch } from '@/components/ui/switch'Examples
API reference
The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Switch's API reference.