Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Tag Group

A set of tags that can be selected as filters or removed, each a chip.

Built on the headless Tag Group.See its API in Docs

Rendered by React 19.3.1

tag-group.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/tag-group.json

It also adds utils, button. The app needs its setup first: Installation.

Usage

Put one TagGroupTag per tag inside TagGroup, each holding a TagGroupTagContent with a TagGroupTagText. To let tags be removed, handle onRemove and add a TagGroupTagRemove to each content; to let them be selected, set selectable (and multiple for several). A TagGroupEmpty shows while the group has no tags. Name the group with aria-label or aria-labelledby. The selection, the removal keys, the focus and the announcements come from the headless Tag Group.

import {
  TagGroup,
  TagGroupEmpty,
  TagGroupTag,
  TagGroupTagContent,
  TagGroupTagRemove,
  TagGroupTagText,
} from '@/components/ui/tag-group'

Examples

Default

Labels with their remove buttons, and the empty text once all are gone.

Its preview and code are at the top of the page.

Selectable

Filters selected several at a time, the selected ones with a check.

Rendered by React 19.3.1

tag-group-selectable.tsx

A tag is a filled chip. A selected tag is outlined in primary and shows a check before its text, and a disabled tag is dashed and unfilled, so neither state is told by its color only (WCAG 1.4.1). The remove button is the Button's ghost icon-xs, 24 by 24 CSS pixels (WCAG 2.5.8). A focused tag rings its chip. This item takes Base UI's component ID as its slug and one name per Base UI part.

API reference

The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Tag Group's API reference.