shadcn.io is not affiliated with official shadcn/ui
Spinner examples · Button
Loading Small Button Spinner for React
A small disabled button with a smaller spinner before its Please Wait label.
A loading state for tight spots such as table rows and toolbars. This sm button is disabled while the work runs, with a 12px Spinner before the Please Wait label.
Preview
Installation
FAQ
How is this button small?
size is sm on the Button. The Spinner also has size-3 (12px), so the wheel matches the shorter button. The default spinner is size-4.
How does the spinner sit in front of Please Wait?
The Spinner is the first child, with data-icon set to inline-start and className set to size-3. The button spaces that icon before the words.
Why is the small button disabled?
So it can't be pressed again while the label is Please Wait. disabled is set, and the button keeps its sm size at reduced opacity.
Can the label be shorter?
Yes. This file uses "Please Wait". A shorter string such as "Wait" or "Saving" still sits after the size-3 spinner. Keep size="sm" and data-icon.
Related
- Loading Button SpinnerA disabled button with a spinner before
- Loading Icon Button SpinnerA disabled icon-only button that shows
- Button with Text (Standard)The one filled action
- Loading Outline Button SpinnerA disabled outline button with a spinner
- Inline with Text SpinnerA spinner beside a Loading data
- Loading Secondary Button SpinnerA disabled secondary button with a