Tag Group

Loading...

Installation

Add the component with the CLI.

npx shadcn@latest add @intentui/tag-group

Manual installation

Install the dependencies, then copy the component source into your project.

npm install react-aria-components @heroicons/react cn

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.

Loading...

Controlled

Manage the values of the tag group through the value prop.

Loading...

Incorporate a hyperlink within the tag group using the href prop.

Loading...

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.

Loading...

Component API

Tag

Tag extends the React Aria Components <Tag> component.

classNamestring

TagGroup

TagGroup extends the React Aria Components <TagGroup> component.

classNamestring

TagList

TagList extends the React Aria Components <TagList> component.

classNamestring

See the React Aria for the full API reference.

Design