component
Spinner
Something is working and you can't tell how long it'll take. A grey ring with a green quarter that turns.
SmallMediumimport { Spinner } from 'rost/components/spinner/Spinner'
<Spinner label="Syncing with the bank" /> src/components/spinner/Spinner.tsx
import type { HTMLAttributes } from 'react'
import './spinner.css'
export interface SpinnerProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
readonly size?: 'small' | 'medium'
/** What's working, for screen readers. */
readonly label?: string
}
const b = 'rost-spinner'
/**
* Something is working and you can't tell how long it'll take: a grey ring
* with a green quarter that turns. Built from contracts/spinner.contract.yaml.
*/
export function Spinner({ size = 'medium', label = 'Loading', className, ...rest }: SpinnerProps) {
return (
<span role="status" aria-label={label} className={[b, `${b}--size-${size}`, className].filter(Boolean).join(' ')} {...rest}>
<span className={`${b}__track`} aria-hidden="true" />
<span className={`${b}__arc`} aria-hidden="true" />
</span>
)
}
The source for everything on this page: contracts/spinner.contract.yaml (opens in a new tab). The CSS, the docs and the checks in each app are built from it.
# yaml-language-server: $schema=../schema/component-contract.schema.json
schemaVersion: 2
id: spinner
name: Spinner
kind: component
status: review
summary: Something is working and you can't tell how long it'll take. A grey ring with a green quarter that turns.
category: feedback
related: [ progress, skeleton, button ]
source:
tool: figma
fileKey: 1Zy0wiWKXQAvsfDBX3KR0d
nodeId: "742:21"
url: https://www.figma.com/design/1Zy0wiWKXQAvsfDBX3KR0d/UI-Kit-v01?node-id=742-21
extractedAt: "2026-11-16"
extractedBy: hand
frozenAt: "2026-11-16"
props:
size:
type: enum
values: [ small, medium ]
default: medium
notes: "`small` (16) inside a button or a line of text, `medium` (20) on its own."
label: { type: string, default: Loading, notes: "What's working, for screen readers: \"Saving\", \"Syncing with the bank\"." }
elements:
root:
notes: "A `<span role=\"status\">` with the label. It holds the ring and its turning arc."
styles:
display: { value: inline-block, assert: false }
position: { value: relative, assert: false }
flex-shrink: { value: "0", assert: false }
vertical-align: { value: middle, assert: false }
track:
notes: The whole ring, in the tertiary grey.
styles:
position: { value: absolute }
inset: { value: "0" }
border-style: { value: solid }
border-width: { token: spacing/outline/medium, value: 2px }
border-color: { token: spinner/track, value: "#3a3a3a" }
border-radius: { token: spacing/radius/full, value: 10000px }
arc:
notes: "A quarter of the ring in the positive green, over the track. It's what turns: one turn every 600ms, at an even speed."
styles:
position: { value: absolute }
inset: { value: "0" }
border-style: { value: solid }
border-width: { token: spacing/outline/medium, value: 2px }
border-color: { value: transparent, assert: false }
border-top-color: { token: spinner/arc, value: "#00d669" }
border-radius: { token: spacing/radius/full, value: 10000px }
animation-name: { value: rost-spinner-turn, assert: false }
animation-duration: { token: motion/duration/slower, value: 600ms }
animation-timing-function: { value: linear, assert: false, notes: "No easing: a turn that speeds up and slows down reads as stuck." }
animation-iteration-count: { value: infinite, assert: false }
keyframes:
turn:
from: { transform: "rotate(0deg)" }
to: { transform: "rotate(360deg)" }
reducedMotion:
notes: "For someone who asks for less motion, it turns five times slower. Stopped, it would look broken."
elements:
arc:
animation-duration: { value: 3s, notes: "Five of motion/duration/slower." }
variants:
- when: { size: small }
figmaNode: "742:14"
elements:
root:
width: { token: spacing/size/2xsmall, value: 16px }
height: { token: spacing/size/2xsmall, value: 16px }
- when: { size: medium }
figmaNode: "742:17"
elements:
root:
width: { token: spacing/size/xsmall, value: 20px }
height: { token: spacing/size/xsmall, value: 20px }
guidance:
status: proposed
use:
- title: A short wait you can't measure
text: "Saving, sending, signing in: a second or two with no way to say how far along it is."
show: size=medium
- title: Inside a button
text: "In place of the button's icon while its action runs, at `small`. Keep the label, and disable the button."
show: size=small
avoid:
- title: Waits you can measure
text: "An upload or an import with a count. That's **Progress**."
- title: Content that's loading
text: "A list or a card on its way. Show its shape with **Skeleton**, so the page doesn't jump."
behaviour: |-
A grey ring with a green quarter turning once every 600ms. For someone who's asked for less motion it turns five times slower; I didn't stop it, because a still spinner looks like something broke. The picture in Figma is its first frame.
accessibility:
element: "`<span role=\"status\">`, so the label is read when it appears."
name: "`label`. Say what's happening, not \"Spinner\"."
colour: "The green arc is 9:1 on the dark page. The grey ring is decoration."
content: "The label in sentence case, as a present participle: \"Saving\"."
Install
npx github:Runceanu/rost add spinner It lands in src/rost/spinner/, with what it needs and its contract. Install has the rest.
When to use
A short wait you can't measure
Saving, sending, signing in: a second or two with no way to say how far along it is.
Inside a button
In place of the button's icon while its action runs, at
small. Keep the label, and disable the button.
When not to use
Waits you can measure
An upload or an import with a count. That's Progress.
Content that's loading
A list or a card on its way. Show its shape with Skeleton, so the page doesn't jump.
Behaviour
A grey ring with a green quarter turning once every 600ms. For someone who's asked for less motion it turns five times slower; I didn't stop it, because a still spinner looks like something broke. The picture in Figma is its first frame.
Accessibility
- Element
<span role="status">, so the label is read when it appears. - Name
label. Say what's happening, not "Spinner". - Colour
The green arc is 9:1 on the dark page. The grey ring is decoration.
Content
The label in sentence case, as a present participle: "Saving".
Props
| Prop | Type | Values | Default |
|---|---|---|---|
size | enum | small · medium | medium |
label | string | | Loading |
Values
Straight from the contract. Each value sits next to its token, because six tokens here all come out as #3a3a3a and the colour alone can't tell you which one is right.
Never changes
root
displayinline-block · positionrelative · flex-shrink0 · vertical-alignmiddle
track
-
border-stylesolidno token yet -
border-width2pxspacing/outline/medium -
border-color#3a3a3aspinner/track -
border-radius10000pxspacing/radius/full
positionabsolute · inset0
arc
-
border-stylesolidno token yet -
border-width2pxspacing/outline/medium -
border-top-color#00d669spinner/arc -
border-radius10000pxspacing/radius/full -
animation-duration600msmotion/duration/slower
positionabsolute · inset0 · border-colortransparent · animation-namerost-spinner-turn · animation-timing-functionlinear · animation-iteration-countinfinite
Changes by variant
2 variants. Each table is what one thing changes with: a column per size, a row per property. Where every row starts with the same token path, it's written once, under the property.
Follows size
| Property | Small | Medium |
|---|---|---|
root.heightspacing/size/… | 2xsmall 16px | xsmall 20px |
root.widthspacing/size/… | 2xsmall 16px | xsmall 20px |