# Tag Group

> Group of tags with single or multiple selection and remove.

Registry name: `tag-group`. HTML docs: https://ui.anuragroy.dev/component/tag-group.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/tag-group.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/tag-group.json`.

Registry JSON: https://ui.anuragroy.dev/r/tag-group.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/tag-group.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import { TagGroup } from "@/components/ui/tag-group"
```

## Usage

```tsx
import { Tag } from "@/components/ui/tag"
import { TagGroup } from "@/components/ui/tag-group"

export function Example() {
  return (
    <TagGroup
      label="Topics"
      selectionMode="multiple"
      defaultValue={["react"]}
      onRemove={() => undefined}
    >
      <Tag value="react" removable>React</Tag>
      <Tag value="vue" removable>Vue</Tag>
    </TagGroup>
  )
}
```

## API

### TagGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | React.ReactNode | — |  |
| `selectionMode` | "none" \| "single" \| "multiple" | — |  |
| `value` | string[] | — |  |
| `defaultValue` | string[] | — |  |
| `onValueChange` | (value: string[]) => void | — |  |
| `onRemove` | (value: string) => void | — |  |
| `disabled` | boolean | — |  |

## See also

- [HTML page](https://ui.anuragroy.dev/component/tag-group): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/tag-group.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
