Skip to content
Redpanda UI
Esc
↑↓navigate↵open⌘Jpreview
Made by shadcn
Edit on GitHub

Spinner

An indicator that can be used to show a loading state.

Powered by

Installation

bash
npx shadcn@latest add @redpanda/spinner
bash
pnpm dlx shadcn@latest add @redpanda/spinner
bash
yarn dlx shadcn@latest add @redpanda/spinner
bash
bunx shadcn@latest add @redpanda/spinner
bash
nubx shadcn@latest add @redpanda/spinner
bash
aube dlx shadcn@latest add @redpanda/spinner

When to use

Use this decision tree to determine when to use the Spinner component:

Usage

tsx
import { Spinner } from '@/components/ui/spinner';
tsx
<Spinner />

Anatomy

The Spinner component is a simple animated loading indicator. Here’s how it’s structured:

tsx
<Spinner />  {/* Animated icon with spin animation */}

Layout Structure

  • Spinner: Single SVG icon with animate-spin animation applied
  • Size controlled via className (size-4, size-6, etc.)
  • Color controlled by the finite tone recipe; the default inherits its surrounding control’s ink

Typical Usage Patterns

tsx
// Standalone<Spinner />
// Custom size<Spinner className="size-8" />
// Owned context color<Spinner tone="primary" />
// In button<Button disabled>  <Spinner />  Loading...</Button>
// In badge<Badge>  <Spinner className="size-3" />  Processing</Badge>
// In input group<InputGroup>  <InputGroupInput placeholder="Searching..." />  <InputGroupAddon>    <Spinner />  </InputGroupAddon></InputGroup>
// In empty state<Empty>  <EmptyHeader>    <EmptyMedia>      <Spinner className="size-8" />    </EmptyMedia>    <EmptyTitle>Loading data</EmptyTitle>  </EmptyHeader></Empty>
// In item<Item>  <ItemMedia>    <Spinner />  </ItemMedia>  <ItemContent>    <ItemTitle>Processing...</ItemTitle>  </ItemContent></Item>

Customization

Use the installed component’s tone recipe rather than copying a second spinner implementation or overriding its text color. If you change the glyph in the installed owner, preserve the finite tones, native SVG props, and role="status" accessibility contract.

Examples

Size

Use the size-* utility class to change the size of the spinner.

Color

Use tone for a supported context color. It does not change the pending state into a completed or failed operation. The default inherits the current color so spinners inside buttons and badges keep the correct foreground in both themes.

Button

Add a spinner to a button to indicate a loading state. The <Button /> will handle the spacing between the spinner and the text.

Badge

You can also use a spinner inside a badge.

Input Group

Input Group can have spinners inside <InputGroupAddon>.

Empty

Item

Use the spinner inside <ItemMedia> to illustrate a loading state. This example is a static download snapshot, not a live transfer. Its progress matches the displayed 129 MB out of 1000 MB; it has no pretend Cancel action.

API Reference

Spinner

Use the Spinner component to display a spinner.

PropType
tone?'default' | 'primary' | 'brand' | 'informative' | 'success' | 'warning' | 'destructive'

Owned context ink; default inherits the surrounding control without claiming task completion

Type'default' | 'primary' | 'brand' | 'informative' | 'success' | 'warning' | 'destructive'
Defaultdefault
className?string

Geometry and layout classes, not text-color overrides

Typestring
tsx
<Spinner />

Props

Credits

  • We take our inspiration from Shadcn UI for the spinner component and style.

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
See full history →

Last updated on

Was this page helpful?