Switch
Turns a setting on or off right away. 44 × 24px track with a 44px tall hit area.
Installation
npx shadcn@latest add @sevenone/switchUsage
import { Switch } from "@/components/ui/switch"Examples
With label
<div className="flex items-center gap-3">
<Switch id="airplane" />
<Label htmlFor="airplane">Airplane mode</Label>
</div>Accessibility
- Use a switch for settings that apply at once; use a checkbox inside forms.
- It is announced as a switch with its on/off state.