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 propertyValueAliasResolves to
--ct-badge-backgroundvar(--accent-tint){colors.accentTint}#EAF1FB #182944
--ct-badge-colorvar(--accent){colors.accent}#0B4EA2 #92B8F5
--ct-badge-font-sizevar(--fs-sub){type.sub}13
--ct-badge-font-weightvar(--weight-bold){weight.bold}700
--ct-badge-gapvar(--space-8){space.s8}8 pt
--ct-badge-heightvar(--size-badge-height){size.badgeHeight}30 pt
--ct-badge-padding-xvar(--space-12){space.s12}12 pt
--ct-badge-radiusvar(--radius-pill){radius.pill}999 pt

Variants

One form; no variants. .ct-badge is a pill label with an optional leading glyph. Nothing else exists; a colored label is a Chip, a status word a Status.

<!-- Do -->
<span class="ct-badge"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-refresh"></use></svg>Proposed</span>
<!-- Don't: a badge as a button or a filter -->
<button class="ct-badge" type="button">Buses</button>

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.