Badge

ui.css · Cross-system: Cross-system reference § Content

Overview

.badge — small status pill for labels, counts, and tags. Always non-interactive. For actionable pills, use .btn.sm instead. A badge is never a form field's value: a value the caller may not change stays a field, so that it does not read as a control (Form field states).

Anatomy

A <span> (or other inline element) with class="badge" and optionally one variant class, plus the stackable .pulse modifier. Supported variants and modifiers are listed on Modifiers.

The badge is an inline-flex row with a --size-1 gap, so a leading <ui-icon> next to the label needs no extra spacing markup: <span class="badge outline"><ui-icon name="user"></ui-icon> Owner</span>.

Usage

Default
Show code

Variants

.destructive, .warning and .cancelled use dark backgrounds with white text in both light and dark mode, keeping their appearance consistent. .warning and .cancelled are specific to badges because they describe status rather than an action. This is why Modifiers lists them as badge-only while .outline and .destructive are shared.

Default Secondary Outline Brand Failed Warning Cancelled
Show code

.pulse — live state

.pulse is a modifier rather than a variant: it composes with any variant above and fades the badge's opacity on a 2 s loop, to indicate ongoing activity — "Recording in progress". For that fade, reach for this class and not Open Props' --animation-pulse, which scales the element instead of fading it. The animation stops entirely under prefers-reduced-motion: reduce; the badge label still conveys the state.

plain.pulse
.badge Default Default
.badge.secondary Secondary Secondary
.badge.outline Outline Outline
.badge.brand Brand Brand
.badge.destructive Failed Failed
.badge.warning Warning Warning
.badge.cancelled Cancelled Cancelled

In context

Common uses: language tags on cards, status pills on jobs, counts on notification icons.

DocumentSV ExportFailed Notifications3
Show code

Accessibility

Cross-system

See Cross-system reference § Content. The Badge row maps ours to Open UI's Badge research and Bootstrap's .badge; Material Web and APG have no badge of their own. The neighbouring Tag / Chip row is where Material's md-chip sits — a static chip is this .badge, while an interactive, removable chip is <ui-combobox chips multiple>.

See also