Components
Error state
Actionable API, network and decoding failure states: full-surface, inline stale-data banner and compact widget/Live Activity variants.
Live example
Rendered with the real classes from /site/chitransit.css, light (left) and dark (right).
.ct-error-state--surface.ct-error-state--inlinelarge text override.ct-error-state--compactCode
<div style="width:100%;min-height:220px"><div class="ct-error-state ct-error-state--surface" role="group"><svg class="ct-error-state__icon" aria-hidden="true"><use href="#i-alert"/></svg><div class="ct-error-state__body"><p class="ct-error-state__message">Couldn’t load arrivals</p><p class="ct-error-state__meta">Check your connection and try again.</p></div><button class="ct-error-state__action" type="button">Retry</button></div></div>
<div class="ct-error-state ct-error-state--inline" role="group"><svg class="ct-error-state__icon" aria-hidden="true"><use href="#i-alert"/></svg><div class="ct-error-state__body"><p class="ct-error-state__message">Couldn’t update arrivals</p><p class="ct-error-state__meta">Updated 3 min ago</p></div><button class="ct-error-state__action" type="button">Retry</button></div>
<div class="ct-error-state ct-error-state--inline" role="group" style="--error-state-message-font-size:var(--fs-title);--error-state-meta-font-size:var(--fs-sub)"><svg class="ct-error-state__icon" aria-hidden="true"><use href="#i-alert"/></svg><div class="ct-error-state__body"><p class="ct-error-state__message">Couldn’t update nearby stops</p><p class="ct-error-state__meta">Updated 12 min ago</p></div><button class="ct-error-state__action" type="button">Retry</button></div>
<span class="ct-error-state ct-error-state--compact" role="status"><svg class="ct-error-state__icon" aria-hidden="true"><use href="#i-alert"/></svg><span class="ct-error-state__message">Can’t update</span></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-error-state-action-background | var(--accent-tint) | {colors.accentTint} | #EAF1FB #182944 |
--ct-error-state-action-background-hover | var(--accent-tint-hover) | {colors.accentTintHover} | #D8E4F4 #1F3352 |
--ct-error-state-action-color | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-error-state-action-font-size | var(--fs-sub) | {type.sub} | 13 |
--ct-error-state-action-font-weight | var(--weight-bold) | {weight.bold} | 700 |
--ct-error-state-action-height | var(--size-minimum-tap-target) | {size.minimumTapTarget} | 44 pt |
--ct-error-state-action-padding-x | var(--space-14) | {space.s14} | 14 pt |
--ct-error-state-action-radius | var(--r-card) | {radius.card} | 12 pt |
--ct-error-state-background-compact | var(--card-2) | {colors.card2} | #E9EBF1 #1F2733 |
--ct-error-state-background-inline | var(--card) | {colors.card} | #EDEEF1 #1D232D |
--ct-error-state-background-surface | var(--card) | {colors.card} | #EDEEF1 #1D232D |
--ct-error-state-compact-gap | var(--space-6) | {space.s6} | 6 pt |
--ct-error-state-compact-padding-x | var(--space-10) | {space.s10} | 10 pt |
--ct-error-state-compact-padding-y | var(--space-6) | {space.s6} | 6 pt |
--ct-error-state-compact-radius | var(--radius-pill) | {radius.pill} | 999 pt |
--ct-error-state-frame | var(--shadow-frame) | {shadows.frame} | |
--ct-error-state-icon-color | var(--alert) | {colors.alert} | #C85414 #F08A4A |
--ct-error-state-icon-size-compact | var(--size-metadata-glyph) | {size.metadataGlyph} | 16 pt |
--ct-error-state-icon-size-inline | var(--size-control-glyph) | {size.controlGlyph} | 22 pt |
--ct-error-state-icon-size-surface | var(--size-alert-glyph) | {size.alertGlyph} | 28 pt |
--ct-error-state-inline-gap | var(--space-10) | {space.s10} | 10 pt |
--ct-error-state-inline-padding-x | var(--space-14) | {space.s14} | 14 pt |
--ct-error-state-inline-padding-y | var(--space-12) | {space.s12} | 12 pt |
--ct-error-state-inline-radius | var(--r-card) | {radius.card} | 12 pt |
--ct-error-state-message-color | var(--ink) | {colors.ink} | #101A2E #EEF1F6 |
--ct-error-state-message-font-size | var(--fs-body) | {type.body} | 16 |
--ct-error-state-message-font-weight | var(--weight-semibold) | {weight.semibold} | 600 |
--ct-error-state-meta-color | var(--muted) | {colors.muted} | #5B6472 #B0BACA |
--ct-error-state-meta-font-size | var(--fs-cap) | {type.cap} | 12 |
--ct-error-state-meta-font-weight | var(--weight-medium) | {weight.medium} | 500 |
--ct-error-state-surface-gap | var(--space-12) | {space.s12} | 12 pt |
--ct-error-state-surface-max-width | var(--size-error-state-maximum-width) | {size.errorStateMaximumWidth} | 360 pt |
--ct-error-state-surface-padding-x | var(--space-20) | {space.s20} | 20 pt |
--ct-error-state-surface-padding-y | var(--space-32) | {space.s32} | 32 pt |
--ct-error-state-surface-radius | var(--r-card) | {radius.card} | 12 pt |
React Native
Use the shared component from @chitransit/signal/rn. API and live gallery.
Contract
Contract: components/error-state.yaml. States are drawn live by transit.js.
Loading the contract…
Variants
--surface fills a pane (message, meta and Retry), --inline sits in a card or list row (message and meta), --compact is one short line. Nothing else exists; there is no default, so always name one.
- The whole pane failed to load:
--surfacewith Retry. - One section of a page failed:
--inline. - A small value is missing (a time, a count):
--compact.
<!-- Do -->
<span class="ct-error-state ct-error-state--compact" role="status">…</span>
<!-- Don't: a toast or red text in place of the error state -->
<p style="color:red">Error</p>
Usage
Do
- Use full-surface when no trustworthy content can be shown.
- Use inline stale when old arrivals remain visible; include
Updated X ago. - Use compact copy
Can’t update
in widgets and Live Activities.
Don't
- Don’t show network failures as
No arrivals
,No stops
,Last stop
, or current-looking stale data. - Don’t expose exception names, endpoints or upstream error bodies to riders.
Accessibility
- Hide the alert glyph from assistive technology; the message carries the meaning.
- Full and inline variants use a real Retry button with a 44pt minimum target.
- VoiceOver should encounter the message, freshness when present, and the Retry action in that order.