0.1.0-rc.2

Tag Group

Tag groups display selected values as removable chips, commonly used in multi-select fields and filter bars.

Try it

reacttypescript

Usage

Bind value as a comma-separated list. Compose RuiTagList, RuiTag, and RuiTagRemove for custom tag rendering.

import { RuiTagGroup, RuiTagList, RuiTag, RuiTagRemove } from '@ecopages/radiant-ui/tag-group';
 
<RuiTagGroup value="react,typescript" selectionMode="multiple" label="Skills">
  <RuiTagList>
    <RuiTag id="react">React<RuiTagRemove /></RuiTag>
    <RuiTag id="typescript">TypeScript<RuiTagRemove /></RuiTag>
  </RuiTagList>
</RuiTagGroup>

Embedded in selects

Set embedded when tags render inside a select or combobox trigger rather than standalone.

Theming

Tag Group surfaces map to semantic surface roles, never Tailwind palette steps:

PartCSS roles
Tag (rui-tag)surface, border, on-background, rounded-pill
Selected tag (rui-tag[aria-selected='true'])primary, on-primary
Remove control (rui-tag__remove)currentColor; hover on-background
Disabled tag--opacity-muted

Override roles at the theme layer, not in component CSS.

API

RuiTagGroup is a custom element (<rui-tag-group>) wrapping a focusable list of tags. Compose RuiTagList, RuiTag, and RuiTagRemove, or pass tags to the helper for the simple API.

Attributes

AttributeTypeDefaultDescription
valuestring''Comma-separated selected values.
labelstring''Accessible name for the tag list.
disabledbooleanfalseDisable selection and removal.
selection-modesingle · multiplemultipleAllow one or many selected tags.
embeddedbooleanfalseDisable selection when a parent component owns the selected values.

Slots

SlotDescription
(default)Tag content, RuiTagList / RuiTag / RuiTagRemove, or data-tag markup.

Events

EventDetailDescription
rui-change{ value: string }Emitted when selection changes; value is comma-separated.
rui-remove{ value: string }Emitted when a tag is removed; value is the removed tag's value.

View helpers

ComponentRendersNotes
RuiTagGroup<rui-tag-group>Accepts tags (RuiTagData[]) or children.
RuiTagListTag list divFlex-wrap container.
RuiTagTag spandata-tag; includes RuiTagRemove.
RuiTagRemoveRemove buttondata-tag-remove.

CSS classes

Public BEM classes on the composed light-DOM surface (documented via @cssclass):

ClassDescription
.rui-tag-groupRoot wrapper around the tag list.
.rui-tag-group__listTag row (flex-wrap container).
.rui-tagTag chip; selected state via [aria-selected='true'].
.rui-tag__removeTag remove control.

Theme roles

PartCSS variables consumed
Tag--surface, --border, --on-background, --radius-pill
Selected tag--primary, --on-primary
Remove hover--on-background
Disabled--opacity-muted
Focus ring--focus-ring

Accessibility

  • Each tag exposes its label text to screen readers.
  • Remove buttons have accessible names indicating which tag will be removed.
  • The group has an accessible name via label when not described by surrounding text.