Tag

Categorize content, optionally toggle a filter or request its removal.

Usage

<script type="module" src="/assets/components/tag/qds-tag.js"></script>
<qds-tag id="tag-static" label="Energy"></qds-tag>

API and behavior

API Contract
label / default slot Noninteractive tag content; label supplies fallback text.
severity neutral, info, success, warning, error.
selectable, selected Boolean properties/attributes for optional toggle behavior.
removable, disabled Boolean properties/attributes for removal and interaction policy.
remove-label Explicit accessible remove action; default Remove plus tag text.

Static tags have text semantics. Selectable labels expose a separate toggle button with aria-pressed, keyboard Enter/Space, and a 44px minimum height. Removal uses a sibling native 44px button, avoiding nested interactive controls. Disabled tags do not toggle or request removal. Selected styling supplements semantic color.

User selection emits bubbling/composed qds-change with { component, selected }. qds-remove is a cancelable removal request with { component }; the application owns the collection and removes the element when accepted. Restore focus to a neighboring tag or logical successor after removal. Programmatic property changes emit no events. CSS parts: tag, label, remove.

Themes, lifecycle and integration

The component uses native Web Components with an open shadow root, existing QDS CSS custom properties, and no framework runtime. Base CSS is loaded once. Set data-theme="dark" or data-theme="light" on a containing element or use the documentation toolbar. Event listeners and observers are removed on disconnect; reconnecting is supported.

Interactive demo ยท P0 contracts and verification

Generated Quangular wrappers expose the same attributes/properties and events using the q-qds- prefix. For child composition, use the documented native child elements inside the wrapper when the native parent requires direct children. See the Quangular catalog for generated type signatures.