Components
Icon button
Round 44pt glyph buttons (live track, favorite, close). aria-pressed=true fills it.
Live example
Rendered with the real classes from /site/chitransit.css, light (left) and dark (right).
.ct-icon-button[aria-pressed="true"][disabled]Code
<button class="ct-icon-button" aria-label="Favorite"><svg viewBox="0 0 24 24" aria-hidden="true" fill="currentColor"><path d="M12 3.2l2.6 5.6 6.1.7-4.5 4.1 1.2 6-5.4-3.1-5.4 3.1 1.2-6L3.3 9.5l6.1-.7z"/></svg></button>
<button class="ct-icon-button" aria-pressed="true" aria-label="Favorite"><svg viewBox="0 0 24 24" aria-hidden="true" fill="currentColor"><path d="M12 3.2l2.6 5.6 6.1.7-4.5 4.1 1.2 6-5.4-3.1-5.4 3.1 1.2-6L3.3 9.5l6.1-.7z"/></svg></button>
<button class="ct-icon-button" disabled aria-label="Favorite"><svg viewBox="0 0 24 24" aria-hidden="true" fill="currentColor"><path d="M12 3.2l2.6 5.6 6.1.7-4.5 4.1 1.2 6-5.4-3.1-5.4 3.1 1.2-6L3.3 9.5l6.1-.7z"/></svg></button>
Tokens
From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.
| Custom property | Value | Alias | Resolves to |
|---|---|---|---|
--ct-icon-button-background | var(--accent-tint) | {colors.accentTint} | #EAF1FB #182944 |
--ct-icon-button-background-hover | var(--accent-tint-hover) | {colors.accentTintHover} | #D8E4F4 #1F3352 |
--ct-icon-button-background-pressed | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-icon-button-background-pressed-hover | var(--accent-hover) | {colors.accentHover} | #0C4691 #A0C1F5 |
--ct-icon-button-card-background | var(--card) | {colors.card} | #EDEEF1 #1D232D |
--ct-icon-button-card-background-hover | var(--card-hover) | {colors.cardHover} | #E4E6E9 #252B35 |
--ct-icon-button-card-background-pressed | var(--card-pressed) | {colors.cardPressed} | #E2E3E7 #2E333D |
--ct-icon-button-card-color | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-icon-button-card-color-prominent | var(--accent-ink) | {colors.accentInk} | #FFFFFF #0F141C |
--ct-icon-button-card-size | var(--size-round-button) | {size.roundButton} | 40 pt |
--ct-icon-button-color | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-icon-button-color-disabled | var(--inactive) | {colors.inactive} | #C9CDD6 #465267 |
--ct-icon-button-color-pressed | var(--accent-ink) | {colors.accentInk} | #FFFFFF #0F141C |
--ct-icon-button-glyph-size | var(--size-control-glyph) | {size.controlGlyph} | 22 pt |
--ct-icon-button-radius | var(--radius-pill) | {radius.pill} | 999 pt |
--ct-icon-button-size | var(--size-icon-button) | {size.iconButton} | 44 pt |
Contract
Contract: components/round-button.yaml. States are drawn live by transit.js.
Loading the contract…
Variants
One form: .ct-icon-button, a round glyph button. aria-pressed="true" fills it while a toggle is on; disabled dims it. Nothing else exists.
<!-- Do -->
<button class="ct-icon-button" aria-pressed="true" aria-label="Favorite"><svg viewBox="0 0 24 24" aria-hidden="true">…</svg></button>
<!-- Don't: no accessible name; no such variant -->
<button class="ct-icon-button ct-icon-button--active"><svg viewBox="0 0 24 24">…</svg></button>
Usage
Do
- Use for round 44pt glyph actions: live tracking, favorite, close.
- Show a toggled state with
aria-pressed="true".
Don't
- Don't ship an icon button without an accessible name.
Accessibility
- Give it
aria-label; the glyph isaria-hidden. - Toggles use
aria-pressed, which also drives the filled style.