Skip to content
Signal

Components

Badge

Pill-shaped labels with an optional glyph, e.g. a page's status.

Live example

Rendered with the real classes from /site/chitransit.css, light (left) and dark (right).

Proposed.ct-badge

Code

<span class="ct-badge"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-refresh"></use></svg>Proposed</span>

Tokens

From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.

Custom propertyValueAlias
--ct-badge-backgroundvar(--accent-tint){colors.accentTint}
--ct-badge-colorvar(--accent){colors.accent}
--ct-badge-font-sizevar(--fs-sub){type.sub}
--ct-badge-font-weightvar(--weight-bold){weight.bold}
--ct-badge-gapvar(--space-8){space.s8}
--ct-badge-height30px
--ct-badge-padding-xvar(--space-12){space.s12}
--ct-badge-radiusvar(--radius-pill){radius.pill}

Usage

Do

  • Use a badge for a page or object status, such as a spec version.

Don't

  • Don't use a badge as a button or a filter; use a chip or route toggle.

Accessibility

  • A badge is text; when it carries a glyph, the glyph is aria-hidden.