Skip to Content
NarakUI

Spinner

Loading spinner components for indicating ongoing processes and operations.

Variants

Three spinners for different surfaces. Each takes a size in pixels and falls back to a gentle opacity pulse when reduced motion is preferred.

BlueSpinner
GraySpinner
GraySpinner2

Blue spinner

BlueSpinner is a blue arc for primary loading states.

16px (default)
24px
32px
48px

Gray spinner

GraySpinner is a ring of bars in the current text color.

16px (default)
24px
32px
48px

Gray spinner 2

GraySpinner2 is a compact ring with a gradient head, used in most loading affordances.

16px (default)
24px
32px
48px

In context

Pair a spinner with a short status line that says what is loading.

Running 128 prompts…
Uploading brand-guidelines.pdf…
Generating report…

Accessible label

Spinners are hidden from assistive technology by default. Pass label when the spinner is the only sign that something is loading. The spinner then renders with role="status" and the label as its accessible name.

Centered

CenteredSpinner centers a GraySpinner2 in an area whose content has not rendered yet. It fills the parent's width and height, with a minimum height of 160px. Pass flex-1 to fill a flex parent, or min-h-0 when the parent sizes itself.

Installation

pnpm dlx shadcn@latest add @narakui/spinner

Add "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/spinner.json.

Usage

import {
  BlueSpinner,
  CenteredSpinner,
  GraySpinner,
  GraySpinner2,
} from '@/components/ui/spinner';

<BlueSpinner size={24} />
<GraySpinner size={20} />
<GraySpinner2 label="Loading results" />
<CenteredSpinner />

Properties

PropTypeDefaultDescription
BlueSpinnerComponent—Blue colored spinner component
GraySpinnerComponent—Gray colored spinner component
GraySpinner2Component—Compact gradient spinner component
CenteredSpinnerComponent—GraySpinner2 centered in a full-width box with a 160px minimum height
sizenumber16Size of the spinner in pixels
classNamestring—Additional CSS classes to apply to the spinner. On CenteredSpinner, applies to the wrapper
labelstring—Accessible name. When set, the spinner renders with role="status". When omitted, it is hidden from assistive technology
aria-labelstring—Alias for label. label wins when both are set
styleCSSProperties—Inline styles for GraySpinner2 (e.g. to sync animation timing)
refRef<SVGSVGElement>—Ref forwarded to the GraySpinner2 SVG element