Spinner
A lightweight loading indicator that provides visual feedback for asynchronous operations and loading states.
Import
Usage
Examples
Basic spinner
Size variants
Color
Custom speed
With text
Loading...
Full page loading
Loading content...
In button
Center aligned
Props
| Prop | Type | Default | Description |
|---|---|---|---|
size | "sm" | "md" | "lg" | "md"* | Size scale |
color | "none" | "default" | "primary" | "secondary" | "danger" | "warning" | "success" | "primary"* | Semantic color |
speed | string | "0.75s"* | Animation duration (CSS time) |
className | string | None | Extra classes, merged with internal styles |
* Falls back through Global Configuration if not set. See below.
Global Configuration
Spinner reads defaults from four places, in this order of precedence:
- Instance prop: set directly on
<Spinner /> - Component config:
components.spinnerin yourashee.config - Theme default:
defaultColorin yourashee.config - Built-in fallback: component's internal default values
Component config
Built-in fallbacks
Accessibility
- Uses
aria-hidden="true"to prevent screen reader announcement - For loading states, use
aria-busyoraria-liveon parent containers - Can be used with
sr-onlytext to provide context for screen readers - Respects reduced motion preferences when configured
Notes
- Speed: The
speedprop accepts any valid CSS animation duration value (e.g.,"0.5s","750ms"). - Color: The
nonecolor uses the background color, which is useful for dark overlays. - SVG: The spinner is rendered as an SVG with standard SVG attributes support.
- Integration: The spinner is used internally in components like Button (loading state) and Input (isLoading state).
- Custom Animation: The spinner uses Tailwind's
animate-spinclass which can be customized globally.