Skip to content

Signal

Components

Skeleton

Redacted loading rows in place of the rows they stand for; no spinner, no shimmer.

Live example

Rendered with the real classes from /site/chitransit.css, light (left) and dark (right).

.ct-skeleton

Code

<div class="ct-skeleton" role="group" aria-busy="true" aria-label="Loading arrivals"><div class="ct-skeleton-row" aria-hidden="true"><span class="ct-skeleton-lead"></span><span class="ct-skeleton-line"></span><span class="ct-skeleton-trailing"></span></div><div class="ct-skeleton-row" aria-hidden="true"><span class="ct-skeleton-lead"></span><span class="ct-skeleton-line"></span><span class="ct-skeleton-trailing"></span></div></div>

Tokens

From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.

Custom propertyValueAliasResolves to
--ct-skeleton-bar-backgroundvar(--inactive){colors.inactive}#C9CDD6 #465267
--ct-skeleton-bar-radiusvar(--radius-pill){radius.pill}999 pt
--ct-skeleton-leadvar(--size-skeleton-lead){size.skeletonLead}24 pt
--ct-skeleton-linevar(--size-skeleton-line){size.skeletonLine}12 pt
--ct-skeleton-row-backgroundvar(--card){colors.card}#EDEEF1 #1D232D
--ct-skeleton-row-column-gapvar(--space-16){space.s16}16 pt
--ct-skeleton-row-gapvar(--space-arrival-stack-gap){spacing.arrivalStackGap}6 pt
--ct-skeleton-row-heightvar(--size-skeleton-row){size.skeletonRow}52 pt
--ct-skeleton-row-padding-xvar(--space-arrival-horizontal-padding){spacing.arrivalHorizontalPadding}14 pt
--ct-skeleton-row-radiusvar(--r-card){radius.card}12 pt
--ct-skeleton-trailingvar(--size-skeleton-trailing){size.skeletonTrailing}44 pt

Contract

Contract: components/skeleton.yaml. States are drawn live by transit.js.

Variants

One form: a .ct-skeleton of .ct-skeleton-rows, each a .ct-skeleton-lead disc, a .ct-skeleton-line and a .ct-skeleton-trailing bar. Leave out the lead for lists without a mode badge. Nothing else exists; the rows never animate.

<!-- Do -->
<div class="ct-skeleton" role="group" aria-busy="true" aria-label="Loading arrivals">
  <div class="ct-skeleton-row" aria-hidden="true"><span class="ct-skeleton-lead"></span><span class="ct-skeleton-line"></span><span class="ct-skeleton-trailing"></span></div>
</div>
<!-- Don't: a spinner on a blank sheet -->
<span class="ct-spinner" role="status" aria-label="Loading"></span>

Usage

Do

  • Show skeleton rows before the first data arrives, in the shape of the rows to come.
  • Keep the current rows on refresh, dimmed when stale.

Don't

  • Don't show a spinner on a blank sheet.
  • Don't animate the rows.

Accessibility

  • The list carries aria-busy="true" and a label such as "Loading arrivals"; the rows are hidden.