Spinner
An inline loading indicator in seven designs, all animated with CSS alone. Every variant renders as a single span with role="status", so it drops straight into the parent's flow with no wrapper.
Installation
Copy the piece into your app — it compiles with your build and the code is yours:
puzzle add piece spinner
Requires the pieces.css tokens merged into your app styles (see Introduction). The keyframes travel inside the piece's own style block, so there is no stylesheet to import.
Usage
import Spinner from '@/components/ui/Spinner.pzl';
<Spinner/> <Spinner variant="ticks" size="sm" label="Saving"/>
Variants
- ring — the default: a border ring with a brand top edge, spinning.
- ticks — eight pill ticks in currentColor. The head steps round like a native activity indicator, and each tick shortens toward the centre as it fades.
- trace — a brand segment running round a squircle. It hurries down each side and slows through the corners, stretching and bunching as it goes.
- dots — three dots written in left to right, held, then faded together. A typing indicator.
- snap — Puzzle’s own. Four tiles drift apart, click back together, and the block turns a quarter.
- spark — a twinkling brand star with a small satellite star circling it. For AI states.
- heartbeat — a lub-dub dot that sends out one faint ring on the second beat. For live or connecting status.
Sizes
Inside a button
Typing indicator
Color
Accessibility and motion
The root carries role="status" and the label prop as its accessible name (default “Loading”); every moving part inside it is aria-hidden. Give the label the real task — “Saving draft”, “Ada is typing” — rather than the default.
Under prefers-reduced-motion: reduce every variant, the ring included, stops moving and takes a slow opacity pulse instead, holding a pose that still reads as busy: the ticks keep their tapered trail, the trace keeps its segment, the dots stay written.