Badge

A compact, noninteractive count or textual status.

Usage

<script type="module" src="/assets/components/badge/qds-badge.js"></script>
<qds-badge id="badge-count" count="120" max="99" severity="info" label="unread messages"></qds-badge>

API and behavior

API Contract
count Nonnegative integer property/attribute; null/absent uses the text slot.
max Overflow threshold, default 99; the full count remains accessible.
dot Compact dot; provide a meaningful label.
label Count suffix or dot description.
severity neutral, info, success, warning, error.
Default slot Noninteractive text when count and dot are absent.

Count 120 with max 99 displays 99+ and exposes the full count to assistive technology. Zero remains visible; hide the host explicitly when desired. Badges are not live regions or interactive targets. Use text/labels to communicate status in addition to color. CSS part: badge; uses existing semantic status and text-on-status tokens.

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.