Components
Mode badge
The train or bus glyph on its mode's shape: bus on a Brand rounded square, train on an Inactive gray circle. Small and large.
Live example
Rendered with the real classes from /site/chitransit.css, light (left) and dark (right).
.ct-mode-badge.ct-mode-badge--lgClark/Lake
on a cardCode
<span class="ct-mode-badge ct-mode-badge--bus" role="img" aria-label="Bus"><svg aria-hidden="true"><use href="#i-bus"/></svg></span><span class="ct-mode-badge ct-mode-badge--train" role="img" aria-label="Train"><svg aria-hidden="true"><use href="#i-train"/></svg></span>
<span class="ct-mode-badge ct-mode-badge--bus ct-mode-badge--lg" role="img" aria-label="Bus"><svg aria-hidden="true"><use href="#i-bus"/></svg></span><span class="ct-mode-badge ct-mode-badge--train ct-mode-badge--lg" role="img" aria-label="Train"><svg aria-hidden="true"><use href="#i-train"/></svg></span>
<div class="ct-card ct-flex ct-gap-12 ct-items-center"><span class="ct-mode-badge ct-mode-badge--train ct-mode-badge--lg" role="img" aria-label="Train"><svg aria-hidden="true"><use href="#i-train"/></svg></span><span>Clark/Lake</span></div>
Tokens
From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.
| Custom property | Value | Alias | Resolves to |
|---|---|---|---|
--ct-mode-badge-bus-background | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-mode-badge-bus-color | var(--accent-ink) | {colors.accentInk} | #FFFFFF #0F141C |
--ct-mode-badge-bus-radius | .28 | ||
--ct-mode-badge-glyph | .6 | ||
--ct-mode-badge-size-large | var(--size-mode-badge-large) | {size.modeBadgeLarge} | 40 pt |
--ct-mode-badge-size-small | var(--size-mode-badge-small) | {size.modeBadgeSmall} | 24 pt |
--ct-mode-badge-train-background | var(--inactive) | {colors.inactive} | #C9CDD6 #465267 |
--ct-mode-badge-train-color | var(--ink) | {colors.ink} | #101A2E #EEF1F6 |
React Native
Use the shared component from @chitransit/signal/rn. API and live gallery.
Contract
Contract: components/mode-badge.yaml. States are drawn live by transit.js.
Loading the contract…
Variants
Mode: --train (Inactive circle) or --bus (Brand rounded square); always name one. Size: small by default, --lg for result cards. Nothing else exists; there is no train-and-bus badge.
<!-- Do -->
<span class="ct-mode-badge ct-mode-badge--bus ct-mode-badge--lg" role="img" aria-label="Bus"><svg aria-hidden="true"><use href="#i-bus"/></svg></span>
<!-- Don't: a route number or a line color in it; that is a route icon -->
<span class="ct-mode-badge ct-mode-badge--bus">22</span>
<span class="ct-mode-badge" style="background:var(--red-line)">…</span>
Usage
Do
- Use a mode badge to lead search results and recent stations.
- Use large in result cards and small in compact rows.
Don't
- Don't badge the glyph elsewhere; use the bare icon.
- Don't put a route number or line color in it; that is a route icon.
Accessibility
- The glyph meets 4.5:1 on its fill in light and dark.
- Inside a row or card, hide the badge; the row speaks the mode.