mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-02 08:58:36 +00:00
39 lines
565 B
Plaintext
39 lines
565 B
Plaintext
---
|
|
title: Switch
|
|
description: A control that allows the user to toggle between checked and not checked.
|
|
component: true
|
|
radix:
|
|
link: https://www.radix-ui.com/docs/primitives/components/switch
|
|
api: https://www.radix-ui.com/docs/primitives/components/switch#api-reference
|
|
---
|
|
|
|
<ComponentPreview name="switch-demo" />
|
|
|
|
## Installation
|
|
|
|
<Steps>
|
|
|
|
### Command
|
|
|
|
```bash
|
|
npx shadcn-ui add switch
|
|
```
|
|
|
|
### Usage
|
|
|
|
```tsx
|
|
import { Switch } from "@/components/ui/switch"
|
|
```
|
|
|
|
```tsx
|
|
<Switch />
|
|
```
|
|
|
|
</Steps>
|
|
|
|
## Examples
|
|
|
|
### Form
|
|
|
|
<ComponentPreview name="switch-form" />
|