Logobaseui-cn

Switch

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

forminteractive
Loading preview...

Installation

npx baseui-cn add switch

Usage

import { Switch } from "@/components/ui/switch"
<Switch label="Email notifications" />

Examples

Basic

A simple switch.

Loading preview...

With label and description

Descriptive switch.

Loading preview...

Disabled

A disabled switch.

Loading preview...

Controlled

A controlled switch.

Loading preview...

API Reference

See the Base UI Switch documentation for the full API reference, including all props, data attributes, and CSS classes.