View fulldotdev/ui on GitHub

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 />

Description

Choice Card

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.

Invalid

Add the aria-invalid prop to the Switch component to indicate an invalid state.

Size

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

RTL

To enable RTL support in shadcn/ui, see the RTL configuration guide.

API Reference

Source: react/src/components/ui/switch.tsx

See the Base UI Switch documentation.