shadcn-vue/apps/www/src/content/docs/components/toggle.md
2023-09-04 22:36:40 +08:00

39 lines
707 B
Markdown

---
title: Toggle
description: A two-state button that can be either on or off.
source: https://github.com/radix-vue/shadcn-vue/tree/main/apps/www/src/lib/registry/default/ui/toggle
primitive: https://www.radix-vue.com/components/toggle.html
---
<ComponentPreview name="ToggleDemo" />
## Installation
```bash
npx shadcn-vue@latest add toggle
```
<ManualInstall>
1. Install `radix-vue`:
```bash
npm install radix-vue
```
2. Copy and paste the component source files linked at the top of this page into your project.
</ManualInstall>
## Usage
```vue
<script setup lang="ts">
import { Toggle } from '@/lib/registry/default/ui/toggle'
</script>
<template>
<Toggle>Toggle</Toggle>
</template>
```