shadcn.io is not affiliated with official shadcn/ui
Spinner examples · Inline
Inline with Text Spinner for React
A spinner beside a Loading data... label on one line.
A spinner with a word or two says what is loading without taking over the layout. Here a default Spinner sits beside Loading data... in a flex row, for a list, a table row or a panel that fills in.
Preview
Installation
FAQ
How does the spinner sit on the same line as the text?
A div with flex items-center gap-2 holds the Spinner and a span. items-center lines them up, and gap-2 is the space between them.
What does the line say?
The span is text-sm and reads "Loading data...". The ellipsis is part of that string. The spinner is the default size, size-4.
How do I put the spinner after the words?
Swap the children: the span first, then the Spinner. The row still uses flex items-center gap-2. Add size-3 on the spinner when it should be smaller than the default.
How do I mute this line?
Add text-muted-foreground on the flex div. The span inherits it, and the spinner does too, because the icon uses currentColor.
Related
- Spinner Before TextA small spinner before a muted line of
- Spinner After TextA small spinner after a line of text
- Loading Button SpinnerA disabled button with a spinner before
- Default SpinnerA spinner at its default size and color
- Spinner in Input GroupA disabled input and textarea with a
- Spinner in ItemA download row with a spinner, the size