shadcn.io is not affiliated with official shadcn/ui
Spinner examples · Button
Loading Button Spinner for React
A disabled button with a spinner before its Loading... label.
A button that shows its click was taken. While the work runs it's disabled, so it can't be pressed twice, and a Spinner sits before the Loading... label.
Preview
Installation
FAQ
Why is the button disabled?
disabled is set on the Button, so it can't be pressed again while its label reads Loading... It draws at reduced opacity.
How does the spinner line up with Loading...?
The Spinner is the first child, with data-icon set to inline-start. That uses the button's own icon spacing, so the wheel sits in front of the label.
Can the label say what is happening?
Yes. This file uses the text "Loading...". Swap that string for "Saving..." or "Sending..." and leave the Spinner where it is.
Which button variant is this?
None is set, so it is the default filled button at the default size. Pass variant or size on the same Button to change the look. Keep it disabled, with the Spinner.
Related
- Loading Outline Button SpinnerA disabled outline button with a spinner
- Loading Icon Button SpinnerA disabled icon-only button that shows
- Inline with Text SpinnerA spinner beside a Loading data
- Button with Text (Standard)The one filled action
- Spinner in Input GroupA disabled input and textarea with a
- Required Field Validation FormA name and an email field marked with