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-badgeCode
<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 property | Value | Alias | Resolves to |
|---|---|---|---|
--ct-badge-background | var(--accent-tint) | {colors.accentTint} | #EAF1FB #182944 |
--ct-badge-color | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-badge-font-size | var(--fs-sub) | {type.sub} | 13 |
--ct-badge-font-weight | var(--weight-bold) | {weight.bold} | 700 |
--ct-badge-gap | var(--space-8) | {space.s8} | 8 pt |
--ct-badge-height | var(--size-badge-height) | {size.badgeHeight} | 30 pt |
--ct-badge-padding-x | var(--space-12) | {space.s12} | 12 pt |
--ct-badge-radius | var(--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.