shadcn.io is not affiliated with official shadcn/ui
Spinner examples · Inline
Spinner Before Text for React
A small spinner before a muted line of text saying changes are syncing.
A quiet status line for background work. A 12px Spinner leads the muted words Syncing your changes, and both take the paragraph's color.
Preview
Installation
FAQ
Why is the spinner before the words?
The Spinner is the first child of the paragraph, and the text "Syncing your changes" is the second. The p is a flex row, so that DOM order is the visual order.
Why are the spinner and the text both muted?
text-muted-foreground is on the p, not on the spinner. The icon uses currentColor, so it picks up the paragraph's text color along with the words.
What size is the spinner next to Syncing your changes?
size-3 (12px) on the Spinner, and text-sm on the paragraph. items-center aligns them, and gap-2 is the space between.
Why is this a paragraph?
The status is one line of text, so the file uses a p with flex on it. The spinner is an SVG inside that paragraph, with role="status".
Related
- Inline with Text SpinnerA spinner beside a Loading data
- Spinner After TextA small spinner after a line of text
- Spinner in List ItemA list item with a muted spinner, a title
- Small SpinnerA small 12px spinner for dense and inline
- Loading Button SpinnerA disabled button with a spinner before
- Spinner in Input GroupA disabled input and textarea with a