⚠️ Design system CSS not found. Check the path in cms/docs.config.js → designSystemPath, then re-run npm run docgen.

Tag

Dismissible labels and filter chips

Design System / Tag
Download .md file
Open .md in new tab

Tag

Tags are small interactive labels used for categorisation, filtering, and metadata display. They support colour variants via data-color and can be dismissible with a remove button.

The class is required. Colour variants use the data-color attribute — the same API as button and badge.


Anatomy

Axis Mechanism Example
Colour data-color data-color="success"

No component-level tokens — tag references system tokens directly (, , ).


Basic usage

Default tag
<span class="tag">Default tag</span>

Colour

data-color applies a semantic colour to background, border, and text.

Default Success Warning Danger Info
<span class="tag" data-color="success">Success</span>
<span class="tag" data-color="warning">Warning</span>
<span class="tag" data-color="danger">Danger</span>
<span class="tag" data-color="info">Info</span>

Dismissible tag

Add a button inside the tag. Clicking it removes the tag from the DOM.

Design Active Published
<span class="tag">
  Design
  <button class="tag-remove" aria-label="Remove Design tag" type="button">{{icon:close}}</button>
</span>

Tag group

Use to wrap multiple tags with consistent spacing.

HTML CSS JavaScript TypeScript React
<div class="tag-group">
  <span class="tag">HTML</span>
  <span class="tag">CSS</span>
  <span class="tag">JavaScript</span>
</div>

In context — active filters

Active filters:

Status: Active Type: Component Version: 2.0

JavaScript

Tag dismiss uses a simple inline event listener — no separate JS file needed:

document.addEventListener('click', function (e) {
  var removeBtn = e.target.closest('.tag-remove');
  if (removeBtn) {
    var tag = removeBtn.closest('.tag');
    if (tag) tag.remove();
  }
});

Accessibility

  • The remove button must have aria-label describing what is being removed
  • Tags are presentational — they don't require ARIA roles
  • When used as filters, consider announcing removal to screen readers via a live region

Usage rules

Do

  • Use tags for categorisation and filter indicators
  • Use data-color to indicate state (success, warning, danger)
  • Include aria-label on every remove button

Don't

  • Don't use tags as buttons — they are labels, not actions
  • Don't use tags for navigation

CSS reference

This section documents how the component is built. For usage, see the sections above.

Styling

Property Value
Display inline-flex
Align items center
Gap
Font family
Font size
Font weight
Line height
Padding var(--space-xs) var(--space-xs) var(--space-xs) var(--space-s)
Border radius
Background
Border var(--border-s) solid var(--border-faded)
Color
White space nowrap

Selectors

Selector Purpose
Base tag styling
.tag[data-color="success"] Green status colour (alias: green)
.tag[data-color="warning"] Yellow status colour (alias: yellow)
.tag[data-color="danger"] Red status colour (alias: red)
.tag[data-color="info"] Blue status colour (alias: blue)
Dismiss button inside a tag
.tag-remove:hover Dismiss button hover — full opacity, subtle background
Flex wrapper for multiple tags with gap: var(--space-xs)
On this page
  • Tag
  • Anatomy
  • Basic usage
  • Colour
  • Dismissible tag
  • Tag group
  • In context — active filters
  • JavaScript
  • Accessibility
  • Usage rules
  • CSS reference
Previous

Badge

Next

Progress

Was this page helpful?

We use this feedback to improve our documentation.

Thanks for your feedback

Send feedback

© 2026 By Default