Faber UI
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

Terminal
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/switch.json

Usage

typescript
"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

  1. 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
  2. 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
Full Switch history

Last updated on

On this page