Skip to main content
Use the shadcn-vue Spinner component inside buttons to show loading states during async operations.

Component Locations

Usage

Import both Button and Spinner, then conditionally render the Spinner inside the button:

Pattern

The loading button pattern consists of three parts:
  1. Disable the button - Add :disabled="isLoading" to prevent double clicks
  2. Show the spinner - Add <Spinner v-if="isLoading" class="mr-2" /> before the text
  3. Keep the text visible - The button text remains visible during loading

Spinner Customization

The Spinner component accepts a class prop for styling:

Examples

Form Submit Button

Delete Button

With Validation