Styles live in scss/components/_tag.scss. Tags are compact labels for filters, metadata, or status. Use static variants for read-only chips, and interactive tags as toggle buttons with aria-pressed.
Static tags
Semantic backgrounds with optional leading icon. Disabled uses .tag--disabled on a <span> (not interactive).
<span class="tag tag--information"><span class="tag__icon" aria-hidden="true">…</span><span class="tag__label">Draft</span></span>
Interactive tags
Dashed border when unselected; solid fill when selected (.tag--interactive-selected). The plus icon hides when selected and a dismiss icon appears.
Filter chips (live)
Click tags to toggle selection. Each control is a <button class="tag tag--interactive"> with aria-pressed (data-tags-live wires the demo).
Use for multi-select filters; expose the group with role="group" and an accessible name.
<div role="group" aria-label="Filters" data-tags-live=""><button type="button" class="tag tag--interactive" aria-pressed="false">
<span class="tag__label">Design</span>
</button><button type="button" class="tag tag--interactive tag--interactive-selected" aria-pressed="true">
<span class="tag__label">Accessibility</span>
</button></div>
JavaScript
import { wireAllTags } from './tag-behavior';
wireAllTags();
Class reference
| Class | Description |
|---|---|
.tag | Base inline-flex chip |
.tag__label | Truncated label text |
.tag__icon | 16px icon (add or dismiss) |
.tag__icon--add | Plus icon when unselected (hidden when selected) |
.tag--neutral … .tag--error | Static semantic variants |
.tag--disabled | Static disabled appearance |
.tag--interactive | Toggle button (dashed border) |
.tag--interactive-selected | Selected toggle (solid fill) |
Customize (Sass)
-
Tag spacing
Adjust padding, gap, and icon size for denser toolbars.@use "pimentcss-design-system" with ( $tag-gap: 0.25rem, $tag-padding-x: 0.5rem, $tag-icon-size: 1rem ); -
Rebuild CSS
Run after editing _tag.scss.npm run build:css
Accessibility (RGAA / WCAG)
Tags and filter chips
- Static tags, use
<span>when not actionable; decorative icons needaria-hidden="true". - Interactive tags, use
<button type="button">witharia-pressed="true|false"for toggle chips. - Groups, wrap related filters in
role="group"witharia-labelor a visible heading referenced byaria-labelledby. - Disabled, use the native
disabledattribute on buttons; do not rely on color alone for state.