Skip to content

Signal

Components

Spinner

Indeterminate loading ring; .ct-icon-spin turns a glyph once (refresh).

Live example

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

.ct-spinner
.ct-icon-spin

Code

<span class="ct-spinner" role="status" aria-label="Loading"></span>
<button class="ct-icon-button" aria-label="Refresh"><svg class="ct-icon-spin" viewBox="0 0 24 24" aria-hidden="true"><use href="#i-refresh"></use></svg></button>

Tokens

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

Custom propertyValueAliasResolves to
--ct-spinner-colorvar(--accent){colors.accent}#0B4EA2 #92B8F5
--ct-spinner-durationvar(--motion-spin-duration){motion.spinDuration}.6 s
--ct-spinner-sizevar(--size-spinner){size.spinner}20 pt
--ct-spinner-stroke-widthvar(--size-focus-ring-width){size.focusRingWidth}2.5 pt
--ct-spinner-trackvar(--line){colors.line}#DADDE3 #263041

Variants

Two classes: .ct-spinner, an indeterminate ring, and .ct-icon-spin, which turns a glyph once (a refresh button). Nothing else exists.

<!-- Do -->
<span class="ct-spinner" role="status" aria-label="Loading"></span>
<!-- Don't: a spinner with no label -->
<span class="ct-spinner"></span>

Usage

Do

  • Use the spinner while a request is in flight and nothing else can show progress.
  • Use .ct-icon-spin to turn a refresh glyph once on press.

Don't

  • Don't show a spinner for under 300 ms; it flickers.

Accessibility

  • Pair the spinner with a status message (role="status") or an aria-label.
  • Under Reduce Motion the spin stops.