shadcn.io is not affiliated with official shadcn/ui
Spinner examples · Button
Loading Secondary Button Spinner for React
A disabled secondary button with a spinner before its Saving Changes label.
A loading state for a secondary action, like saving a draft. This secondary button is disabled while the work runs, with a Spinner before the Saving Changes label.
Preview
Installation
FAQ
How is this a secondary button?
variant is secondary on the Button. The children are the Spinner and the text Saving Changes. disabled is set, so the button can't be pressed again.
How does the spinner line up with Saving Changes?
The Spinner is the first child, with data-icon set to inline-start. That uses the button's icon spacing, so the wheel sits in front of the words.
What color is the spinner here?
The icon uses currentColor, so it takes the secondary button's text color. This file sets no extra color class on the Spinner.
Why does the label say Saving Changes?
That string is the button's text in this file. It tells people which action is running. Swap it for another short status and leave the Spinner and variant as they are.
Related
- Loading Button SpinnerA disabled button with a spinner before
- Loading Outline Button SpinnerA disabled outline button with a spinner
- Button with Right Icon (Standard)An arrow on the main action
- Loading Small Button SpinnerA small disabled button with a smaller
- Loading Icon Button SpinnerA disabled icon-only button that shows
- Spinner in Empty StateA full-area loading state with a spinner