Skip to content

Signal

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 propertyValueAliasResolves to
--ct-icon-button-backgroundvar(--accent-tint){colors.accentTint}#EAF1FB #182944
--ct-icon-button-background-hovervar(--accent-tint-hover){colors.accentTintHover}#D8E4F4 #1F3352
--ct-icon-button-background-pressedvar(--accent){colors.accent}#0B4EA2 #92B8F5
--ct-icon-button-background-pressed-hovervar(--accent-hover){colors.accentHover}#0C4691 #A0C1F5
--ct-icon-button-card-backgroundvar(--card){colors.card}#EDEEF1 #1D232D
--ct-icon-button-card-background-hovervar(--card-hover){colors.cardHover}#E4E6E9 #252B35
--ct-icon-button-card-background-pressedvar(--card-pressed){colors.cardPressed}#E2E3E7 #2E333D
--ct-icon-button-card-colorvar(--accent){colors.accent}#0B4EA2 #92B8F5
--ct-icon-button-card-color-prominentvar(--accent-ink){colors.accentInk}#FFFFFF #0F141C
--ct-icon-button-card-sizevar(--size-round-button){size.roundButton}40 pt
--ct-icon-button-colorvar(--accent){colors.accent}#0B4EA2 #92B8F5
--ct-icon-button-color-disabledvar(--inactive){colors.inactive}#C9CDD6 #465267
--ct-icon-button-color-pressedvar(--accent-ink){colors.accentInk}#FFFFFF #0F141C
--ct-icon-button-glyph-sizevar(--size-control-glyph){size.controlGlyph}22 pt
--ct-icon-button-radiusvar(--radius-pill){radius.pill}999 pt
--ct-icon-button-sizevar(--size-icon-button){size.iconButton}44 pt

Contract

Contract: components/round-button.yaml. States are drawn live by transit.js.

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 is aria-hidden.
  • Toggles use aria-pressed, which also drives the filled style.