Components
Switch
A toggle switch for binary on/off states.
Switch is built on the Base UI Switch primitive. It animates its thumb between checked and unchecked states and supports RTL automatically.
Installation
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/switch.jsonUsage
"use client";
import { Switch } from "@/components/ui/switch";
export default function Example() {
return <Switch />;
}Examples
Default
Sizes
API
The Switch accepts all Switch.Root props from @base-ui/react/switch, plus an optional size prop ("sm" or "default").
Changelog
- v0.3.0Slider thumb is a solid circle at every radius preset, filled with foreground in dark mode instead of rendering as a dark hollow square.patch
- v0.3.0Switch sits at a whole-pixel 16px height, so its thumb is inset 1px on every side instead of rendering off-center.patch
Last updated on