DS0
Components

Spinner

Animated loading indicator that communicates an ongoing process to the user.

Overview

Spinner displays an animated circular indicator to communicate that content is loading or a process is in progress. It includes a screen-reader-accessible label for assistive technology.

Sizes

Usage

<Spinner />
<Spinner size="lg" label="Processing..." />

Inline with Text

<div className="flex items-center gap-2">
  <Spinner size="sm" />
  <span>Saving changes...</span>
</div>

Inside a Button

For button loading states, prefer the Button's built-in isLoading prop instead of manually composing Spinner.

Accessibility

  • Spinner renders with role="status" and aria-live="polite"
  • The label prop provides the accessible name (defaults to "Loading")
  • Screen readers announce the label when the spinner appears

API Reference

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''md'Spinner diameter
labelstring'Loading'Screen reader accessible label
classNamestringAdditional CSS classes

AI Decision Guide

Use Spinner when:

  • Data is being fetched and the duration is unknown
  • A form is submitting and you need inline feedback
  • Content is loading within a section of the page

Don't use Spinner when:

  • Content layout is known → use Skeleton for a placeholder
  • A long process with measurable progress → use Progress
  • Loading the full page → use a full-page skeleton layout
ComponentWhen to Use Instead
SkeletonPlaceholder layout while content loads
ProgressDeterminate progress with a known percentage
ButtonUse isLoading prop for button loading states

On this page