Spinner for Astro
Astro activity indicators for pending controls and page regions.
Installation
bunx --bun shadcn@latest add @gnostic/spinnernpx shadcn@latest add @gnostic/spinnerpnpm dlx shadcn@latest add @gnostic/spinnerCopy the files
src/components/ui/spinner/index.tssrc/components/ui/spinner/spinner.astro
Usage
import { Spinner } from "@/components/ui/spinner"
<Spinner />
Notes
Spinnerworks well as a standalone loading indicator or inline inside aButton.- When it is purely decorative next to visible loading text, the button text can carry the main status message.
Example
<div class="flex items-center gap-2 text-sm">
<Spinner />
<span>Loading results...</span>
</div>
API Reference
Read the installed source for the complete prop types.
When to use Spinner
Use Spinner beside a short loading message or inside a button with a pending action. Choose a size that fits the nearby text. Keep the action label understandable while work is in progress.
Keyboard and behavior
The animation does not start a request or announce a result. Give the surrounding region a suitable status message, and avoid announcing a decorative spinner twice.
Theme and layout
The icon follows text color, so check contrast inside primary and outline buttons. Provide a static text indication for reduced motion and for tasks that fail or take a long time.