Components

Switch

A control that toggles a setting on or off immediately.

Installation

npx shadcn@latest add @blank/switch

Usage

import { Switch } from "@/components/ui/switch"
<Switch id="airplane-mode" />

Examples

Sizes

With a description

A switch applies immediately. When a change only takes effect after Save, use a checkbox instead.

Ask for a code on every new device.
Available on the Team plan.

API Reference

Switch

Every Radix Switch.Root prop, such as checked, defaultChecked, onCheckedChange and disabled, plus:

PropTypeDefault
size"sm" | "default""default"