Switch
A control that allows the user to toggle between a checked and not checked state.
shadcn/ui docs →Preview
Installation
terminal
Other package managers
bunx --bun shadcn@latest add https://trents.tech/r/switch.json
Dependencies: @radix-ui/react-switch
Usage
example.tsx
import { Switch } from "@/components/ui/switch"
import { Label } from "@/components/ui/label"
<div className="flex items-center gap-3">
<Switch id="airplane-mode" />
<Label htmlFor="airplane-mode">Airplane Mode</Label>
</div>