Tag Group
A collection of tags displayed together, allowing users to categorize, filter, or manage multiple labels efficiently. It supports dynamic tag management.
Installation
Install the component via the CLI in one command.
npx shadcn@latest add @intentui/tag-group
Composed components
When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.
Manual installation
Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.
npm install react-aria-components @heroicons/react tailwind-merge
Anatomy
import { Tag, TagGroup, TagList } from "@/components/ui/tag-group"
import { Label } from "@/components/ui/field"<TagGroup selectionMode="multiple">
<Label>Serverless</Label>
<TagList>
<Tag>AWS Lambda</Tag>
<Tag>Google Cloud Functions</Tag>
<Tag>Azure Functions</Tag>
</TagList>
</TagGroup>Examples
With remove button
Tags within the group can include a removal button.
Controlled
Manage the values of the tag group through the value prop.
Links
Incorporate a hyperlink within the tag group using the href prop.
For client-side routing, React Aria recommends using the onAction event to handle navigation programmatically instead of passing an href prop.
This is because some collection items cannot be rendered as native elements due to HTML specification limitations.
Disabled
Disable tags either by setting the isDisabled prop or using disabledKeys on the TagGroup.
Component API
Tag
The Tag component renders one tag item.
| Prop | Type | Default |
|---|---|---|
className | string | - |
TagGroup
The TagGroup component groups related tags.
| Prop | Type | Default |
|---|---|---|
className | string | - |
TagList
The TagList component contains tag items.
| Prop | Type | Default |
|---|---|---|
className | string | - |
See the React Aria for the full API reference.
Unlock the full power ofIntent UI Design
Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.