Skip to content
Fleetline

Badge

Usage

Use a badge to label the status of an object (a vehicle "In service", a work order "Overdue") or a count ("7"). Badges are read-only; for filters use tags, for page-level messages use an alert.

Content: one or two words, sentence case, with a number when it helps ("Due in 3 days"). Keep the vocabulary fixed across the product so "Overdue" always means the same thing.

Anatomy

  1. Container — <span class="badge badge--{tone}">
  2. Icon (tones) — svg.badge__icon, a different shape per tone, aria-hidden
  3. Dot (optional) — .badge__dot instead of an icon
  4. Label — the status word or count
  5. Anchor (optional) — .badge-anchor pins a count or dot to the corner of a control

Examples

States marked hover and focus-visible are frozen with .is-hover and .is-focus-visible. Those classes share their rule with the real pseudo-class; never use them in product code.

Badge

Each tone pairs a contrast-checked feedback color with a distinct icon shape and a word.

7 Alerts 99+
Parked
Scheduled
In service
Due in 3 days
Overdue
<span class="badge badge--danger">
  <svg class="badge__icon" aria-hidden="true" focusable="false"><use href="#icon-octagon-alert"></use></svg>Overdue
</span>
<span class="badge badge--neutral"><span class="badge__dot"></span>Parked</span>

<!-- Count on a control: the number is in the control's name too -->
<span class="badge-anchor">
  <button type="button" class="btn btn--secondary" aria-describedby="overdue-count">Overdue services</button>
  <span class="badge badge--count" id="overdue-count">7</span>
</span>

API

HookValuesPurpose
.badgeblock classPill; neutral by default
.badge--neutral | --info | --success | --warning | --dangermodifier classTone → color.feedback.* fg/bg/border
.badge--countmodifier classSolid inverse pill for numbers
.badge--dotmodifier classText-less dot; the parent carries the meaning
.badge__icon | __dotpart classesLeading shape
.badge-anchorwrapper classPositions a count/dot on a button's corner

Do and don't

Overdue
Do combine tone, icon and a word.
Don’t use an empty red pill to mean overdue.

"Due in 3 days"

Do give a number when timing matters.

Badges as buttons or filters

Don’t make badges clickable; use a tag or button instead.

Accessibility

Badges are static text; they are not focusable and have no keyboard behavior.

Tokens

Custom propertyPurpose
--color-feedback-{info|success|warning|danger}-{bg|fg|border|icon}Tone colors (contrast-checked fg/bg)
--color-bg-subtle, --color-text-default, --color-border-defaultNeutral tone
--color-bg-inverse, --color-text-inverseCount badge
--radius-fullPill shape
--font-size-xs, --font-weight-semiboldLabel
--icon-size-smTone icon