mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-08 22:45:47 +00:00
49 lines
771 B
Plaintext
49 lines
771 B
Plaintext
---
|
|
title: Checkbox
|
|
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/checkbox
|
|
api: https://www.radix-ui.com/docs/primitives/components/checkbox#api-reference
|
|
---
|
|
|
|
<ComponentPreview name="checkbox-demo" />
|
|
|
|
## Installation
|
|
|
|
<Steps>
|
|
|
|
### Command
|
|
|
|
```bash
|
|
npx shadcn-ui add checkbox
|
|
```
|
|
|
|
### Usage
|
|
|
|
```tsx
|
|
import { Checkbox } from "@/components/ui/checkbox"
|
|
```
|
|
|
|
```tsx
|
|
<Checkbox />
|
|
```
|
|
|
|
</Steps>
|
|
|
|
## Examples
|
|
|
|
### With text
|
|
|
|
<ComponentPreview name="checkbox-with-text" />
|
|
|
|
### Disabled
|
|
|
|
<ComponentPreview name="checkbox-with-disabled" />
|
|
|
|
### Form
|
|
|
|
<ComponentPreview name="checkbox-form-single" />
|
|
|
|
<ComponentPreview name="checkbox-form-multiple" />
|