Spinner
An indicator that something is loading, on its own or inside a button.
When to use
- An action is running and the wait is short: saving, connecting a source.
- Inside a button, next to its label, while its action runs.
When not to use
- Content is loading into a known layout: use Skeleton.
- A task with a known length, such as an upload: use Progress.
Install
npx shadcn@latest add @clinia/spinnerClinia rules
- The default size is
size-4(16px), to sit next totext-smlabels. - In a button, keep the label and switch it to the ongoing action:
Saving, notSave.
Do and don't
Accessibility
Built in
- Renders
role="status"witharia-label="Loading". - Stops spinning under
prefers-reduced-motion, like every other animation.
Your responsibility
- Disable the button while its action runs, so it can't be pressed twice.
- For a longer wait, say what is happening in text next to the spinner.
How to test
- Turn on reduced motion in the OS: the spinner stops turning.
- Inspect the spinner in the accessibility tree: it exposes
role="status"and the nameLoading. - Tab to a busy button: it's disabled, and its label still says what's happening.
API
Every prop comes from the native svg element.