Spinner
An indeterminate wait, for when there is no progress to report.
Installation
npx shadcn@latest add https://qure-ui.qure.ai/r/spinner.jsonUsage
import { Spinner } from "@/components/ui/spinner"<Spinner />Reach for Progress whenever you know how far along you are. A spinner says only "something is happening"; a bar that fills says how much longer, and a reader waiting on a study upload wants the second one.
Sizes
Five, matching the icon steps used elsewhere — 12, 16, 20, 24 and 32 pixels.
| Size | Use |
|---|---|
xs | inside a field's trailing slot, or beside a line of small text |
sm | inside a button, or against body text |
md | the default; a panel or a card |
lg | an empty region waiting to be filled |
xl | a whole page or a modal body |
Colour
The spinner draws in currentColor, so it takes the colour of whatever contains it and never
needs to be told which surface it landed on.
In a button
Keep the label. A button whose text is replaced by a spinner loses the only description of what you are waiting for, and it changes width as it does so.
disabled is what stops the second press and what tells assistive technology the control is
unavailable — the spinner is the visible half of that, not the mechanism.
Announcing the wait
By default the spinner carries role="status" and a visually hidden "Loading", so a screen
reader says something when it appears. Pass your own label to be specific:
<Spinner label="Loading worklist" />Pass label={null} when there is already text beside it saying the same thing. Two
announcements of one wait is worse than one.
Reduced motion
Under prefers-reduced-motion the spinner slows from 900ms to 2.4s per turn rather than
stopping. A frozen spinner looks like a crash, which is the opposite of what it is for.
API Reference
Prop
Type