shadcn-vue/apps/www/src/content/docs/components/toggle-group.md
Sadegh Barati 0c7da48f8f
feat: toggle group (#275)
* feat: toggle group

* chore: remove dummy examples

* chore: update pathe and typescript, include scripts in tsconfig include

* refactor: move import type from normal script to script setup

don't know how detypes would react with that normal script
2024-01-16 10:56:54 +03:30

1.4 KiB

title description source primitive
Toggle Group A set of two-state buttons that can be toggled on or off. apps/www/src/lib/registry/default/ui/toggle-group https://www.radix-vue.com/components/toggle-group.html

Installation

npx shadcn-vue@latest add toggle-group

<template #Manual>

Install the following dependencies:

npm install radix-vue

Copy and paste the following code into your project

<<< @/lib/registry/default/ui/toggle-group/ToggleGroup.vue

Usage

<script setup lang="ts">
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'
</script>

<template>
  <ToggleGroup type="single">
    <ToggleGroupItem value="a">
      A
    </ToggleGroupItem>
    <ToggleGroupItem value="b">
      B
    </ToggleGroupItem>
    <ToggleGroupItem value="c">
      C
    </ToggleGroupItem>
  </ToggleGroup>
</template>

Examples

Default

Outline

Single

Small

Large

Disabled