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-spinCode
<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 property | Value | Alias | Resolves to |
|---|---|---|---|
--ct-spinner-color | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-spinner-duration | var(--motion-spin-duration) | {motion.spinDuration} | .6 s |
--ct-spinner-size | var(--size-spinner) | {size.spinner} | 20 pt |
--ct-spinner-stroke-width | var(--size-focus-ring-width) | {size.focusRingWidth} | 2.5 pt |
--ct-spinner-track | var(--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-spinto 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 anaria-label. - Under Reduce Motion the spin stops.