shadcn.io is not affiliated with official shadcn/ui
Button examples · Link
Loading Button (Link) for React
A link-styled button that is disabled and shows a spinner, while a quiet action is still waiting on its own request.
The link variant, disabled, with a spinner and the word Loading. People can see the click already happened, and they cannot press it again.
Use it for Load more or Refresh while the request is in flight. Put the old label back when it finishes, and say what failed if it fails. A Spinner alone does not say which action is waiting. In React, Base UI does not know when your request ends.
Preview
Installation
FAQ
Does this demo use isLoading?
No. The link variant is disabled, with a Spinner (data-icon="inline-start") and the word Loading. variant="link" stays primary text with no fill.
How is isLoading different?
isLoading replaces the label with a centered spinner, holds the width, sets aria-busy, and disables the button. This demo keeps the word next to the spinner, which is the better fit when the action should stay readable.
Why disable a link Button?
So it can't be pressed again while the request runs. The fade is the same disabled treatment as the other variants. An underline doesn't change that.
Can I keep my own label?
Yes. Replace Loading with the action, such as Saving. The spinner is a sibling, not a replacement, in this demo.
Related
- Button with Text (Link)Underline on hover, no fill
- Button with Left Icon (Link)An icon before a quiet action
- Loading Button (Standard)The main action, while it runs
- Loading Button (Outline)An outline, while it runs
- Button with Count (Link)A count on a quiet action
- Button with Kbd (Link)A shortcut on a quiet action