Spinner
A compact indeterminate loading indicator with built-in status semantics.
Usage
import { Spinner } from '@takeoff-ui/react-spar';
<Spinner aria-label="Loading results" />
Playground
Variants
Appearances
Sizes
Label
Spinner does not provide label layout. When visible loading text is needed,
compose it with Label and connect the text with aria-labelledby.
Accessibility
Spinner renders a polite status by default. Use aria-label or
aria-labelledby for a domain-specific name; use native aria-hidden only when
the spinner is purely decorative next to another loading message. When
aria-hidden is true, Spinner does not apply the status role or default
accessible name.
API Reference
Spinner
Props
| Name | Type | Default | Description |
|---|---|---|---|
| size | SpinnerSize | 'base' | Size scale. |
| appearance | SpinnerAppearance | 'rounded' | Visual spinner style. |
| variant | SpinnerVariant | 'neutral' | Color variant. |
| classNames | Partial<Record<SpinnerSlot, string>> | - | Per-slot extra classes. |
| slotProps | Partial<Record<SpinnerSlot, React.HTMLAttributes<HTMLElement>>> | - | Per-slot HTML-attribute overrides. |
| className | string | - | Appends custom classes to the root slot. |
| aria-label | string | 'Loading' | Accessible name for the loading status. Override it for domain-specific loading text. |
| aria-labelledby | string | - | ID reference for visible loading text. When provided, the default aria-label is not applied. |
| aria-hidden | boolean | false | Hides a decorative spinner from assistive technology. When true, status role and default accessible name are not applied. |
Data attributes
| Attribute | Applied when | Purpose |
|---|---|---|
| data-slot="root" | Always | Stable selector for wrapper styling on the root slot. |
| data-variant | Always | Reflects the resolved variant prop for theme recipe scoping. |
| data-size | Always | Reflects the resolved size prop for theme recipe scoping. |
| data-type | Always | Reflects the resolved appearance prop for theme recipe scoping. |
Type Definitions
| Name | Definition |
|---|---|
| SpinnerSize | 'small' | 'base' | 'large' | 'xlarge' |
| SpinnerAppearance | 'rounded' | 'dots' | 'lines' | 'pulse' | 'threeDots' | 'loader' | 'logo' |
| SpinnerVariant | 'primary' | 'secondary' | 'neutral' | 'info' | 'success' | 'danger' | 'warning' |
| SpinnerSlot | 'root' | 'indicator' |