GitHub 560+

Switch

A control that allows the user to toggle between checked and not checked.

Installation

npx shadcn@latest add @fulldev/switch

Usage

---
import { Switch } from "@/components/ui/switch"
---
<Switch />

Examples

Receive occasional updates about new features and product news.

With Label

Card-style selection where FieldLabel wraps the entire Field for a clickable card pattern.

Disabled

Add the disabled prop to the Switch component to disable the switch. Add the data-disabled prop to the Field component for styling.

This setting is managed by your organization.

Sizes

Use the size prop to change the size of the switch.

API Reference

See the GitHub source code for more information on props. See the data-slot docs for more information on interactivity.