Badge

ds-badge shows a status in one shared row. Products supply the words, icon and status meaning; DS1 owns the face, type, truncation and independent scale. It is not a button and adds no tab stop. Its width rounds up to whole squares, within the available space. Content, font and surface-scale changes remeasure once per frame while changing; standing idle does not run a measurement loop.

<ds-badge icon="lock">Password on</ds-badge><ds-badge icon="archive" icon-only data-tooltip="Archived">Archived</ds-badge>

Keep the status words as children even in icon-only mode. The label remains available to assistive technology; the shared icon is decorative. Without an icon, icon-only falls back to displaying the words. Load the shared tooltip helper to explain compact badges on hover or focus of their containing control.

Set --ds-badge-background and --ds-badge-color with shared colour tokens when a status needs a meaningful colour. The default is neutral. Place a badge inside a shared Button when the containing action is interactive. Products may choose the compact mode from available layout space; do not draw a second chip or resize its internal icon and type. Copy badge through Sync 1.

Record states

Icons and short state labels sit beside the content they describe.

Compact status controls

Text badges and icon-only badges use the same compact line.

A badge is one square high, on the fill, its words 4px from the edge. Without icon-only its width rounds up to whole squares, at most the room there is. Words that still do not fit fade over their last square, never an ellipsis, and the fill stays whole. With icon-only and an icon, it is one square wide.

A badge has no role, no press and no tab stop. In icon-only mode its words are hidden from sight and kept for assistive technology, so always write them. The icon is hidden from assistive technology. A tooltip adds to the words and never replaces them.

AttributeTypeDefaultWhat it does
iconstringEmptyThe shared icon before the words.
icon-onlybooleanfalseShows the icon alone, with the words kept for assistive technology.
SlotWhat it holds
DefaultThe status words.
PartWhat it is
frameThe badge’s face.
TokenWhat it does
--ds-badge-backgroundThe fill, --ds-fill by default.
--ds-badge-colorThe ink, --ds-text-color by default.

It has no events. Add hidden to hide it. On Apple platforms it is DS1Badge.