shadcn.io is not affiliated with official shadcn/ui
Spinner examples · Standard
Primary Color Spinner for React
A spinner in the primary color for a branded loading state.
A spinner can carry the brand color when the wait is the main thing on screen. This Spinner takes text-primary, so it follows your theme's primary token, in light and dark mode.
Preview
Installation
FAQ
How does this spinner use the primary color?
Pass text-primary on Spinner. The icon draws with currentColor, so the text class paints the stroke. This file sets that class and nothing else.
Does text-primary follow the theme?
Yes. text-primary reads the same token as primary text elsewhere, including in light and dark mode. Change the token and this spinner follows.
What size is the primary spinner?
It stays at the default size-4 (16px). Add size-3, size-6, or size-8 on the same element to resize it. The color class stays put.
How do I use this color inside a button?
Put the Spinner in the Button with data-icon set to inline-start, and disable the button while the work runs. A filled button already sets its own text color, so the spinner picks that up through currentColor. Add text-primary when the spinner sits outside a button, as this file does.
Related
- Default SpinnerA spinner at its default size and color
- Muted SpinnerA spinner in the muted foreground color
- Loading Button SpinnerA disabled button with a spinner before
- Spinner in Input GroupA disabled input and textarea with a
- Large SpinnerA large 32px spinner for a page or a
- Small SpinnerA small 12px spinner for dense and inline