Installation
Usage
Props
Whether the spinner is purely decorative or conveys meaning:
false: Spinner conveys meaning and requires atitlefor screen readerstrue: Spinner is decorative and title is not announced to screen readers
Accessible label describing what is loading. Required when
decorative={false}.Size of the spinner. Supports all icon size tokens:
sizeIcon10(16px)sizeIcon20(20px) - defaultsizeIcon30(24px)sizeIcon40(28px)sizeIcon50(32px)sizeIcon60(36px)sizeIcon70(40px)sizeIcon80(48px)sizeIcon90(56px)sizeIcon100(64px)sizeIcon110(80px)
Color of the spinner. Accepts any valid CSS color value or Paste color token.
Delay in milliseconds before the spinner appears. Prevents flashing for fast operations.
Overrides the default element name for customization.
HTML element type to render the spinner wrapper as.
CSS display property for the spinner wrapper.
Examples
Basic Spinner
Decorative Spinner
Use when loading context is clear from surrounding content:Different Sizes
Custom Color
Loading Button
Loading State
No Delay Spinner
For operations expected to take time:Centered Spinner
Delay Behavior
By default, spinners have a 250ms delay before appearing. This prevents flashing for fast operations:delay={0} for operations known to take time:
Accessibility
- Always set
decorative={false}and provide a descriptivetitlewhen the spinner conveys meaning - Use
decorative={true}only when loading context is provided by adjacent text - The spinner includes ARIA attributes for screen reader support
- Respects
prefers-reduced-motionfor users with motion sensitivity - Ensure loading states are announced to screen readers
- Don’t rely on the spinner alone - provide text context when possible
Best Practices
- Use spinners for operations that take more than 1 second
- For very quick operations (under 300ms), consider not showing a spinner
- Keep the default 250ms delay to prevent flashing
- Provide descriptive titles that explain what’s loading
- Use appropriate sizes based on the loading context:
- Small spinners (
sizeIcon10-20) for inline elements and buttons - Medium spinners (
sizeIcon40-60) for component-level loading - Large spinners (
sizeIcon80-100) for page-level loading
- Small spinners (
- For page-level loading, consider using SkeletonLoader instead
- Disable interactive elements while loading to prevent duplicate actions
- Always provide a way to cancel long-running operations
- Test with screen readers to ensure loading states are announced