45 lines
875 B
Markdown
45 lines
875 B
Markdown
---
|
|
title: Checkbox
|
|
description: A control that allows the user to toggle between checked and not checked.
|
|
source: apps/www/registry/default/ui/checkbox
|
|
primitive: https://www.reka-ui.com/docs/components/checkbox.html
|
|
---
|
|
|
|
<ComponentPreview name="CheckboxDemo" />
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
npx shadcn-vue@latest add checkbox
|
|
```
|
|
|
|
## Usage
|
|
|
|
```vue
|
|
<script setup lang="ts">
|
|
import { Checkbox } from '@/components/ui/checkbox'
|
|
</script>
|
|
|
|
<template>
|
|
<Checkbox id="terms" />
|
|
</template>
|
|
```
|
|
|
|
## Examples
|
|
|
|
### With text
|
|
|
|
<ComponentPreview name="CheckboxWithText" />
|
|
|
|
### Disabled
|
|
|
|
<ComponentPreview name="CheckboxDisabled" />
|
|
|
|
### Form
|
|
|
|
Please first read `vee-validate` section for [Checkbox and Radio Inputs](https://vee-validate.logaretm.com/v4/examples/checkboxes-and-radio/)
|
|
|
|
<ComponentPreview name="CheckboxFormSingle" />
|
|
|
|
<ComponentPreview name="CheckboxFormMultiple" />
|