Spinner

Spinners indicate short indeterminate loading activity without changing surrounding layout.

Overview and decision boundary

Spinner indicates short indeterminate loading activity without changing surrounding layout.

Do not use Spinner for long tasks where determinate Progress is available.

Preview

Loading activity
import { Spinner } from '@nerio-ui/ui';<Spinner label="Loading activity" />

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm dlx nerio add spinnerimport { Spinner } from '@nerio-ui/ui';

Usage

import { Spinner } from '@nerio-ui/ui';<Spinner label="Loading activity" />

Variants

SizeUse
smCompact size for dense layouts and inline use.
mdDefault size for most product surfaces.
lgLarger size for prominent local actions.

Anatomy

SlotDescription
rootInline loading indicator that is a status or decorative mark, depending on its mode.
labelVisually hidden localized status label, rendered only for standalone Spinner.

States

ModeBehavior
StandaloneRequires label and renders a status with a visually hidden localized label.
DecorativeUse when a parent already owns aria-busy and the loading announcement.
Reduced motionStops rotating and remains visible as a static loading mark.

Motion

  • State changes should use shared motion tokens and preserve reduced-motion behavior.

Accessibility

  • Provide a localized label when Spinner is the loading announcement; use decorative when a parent already exposes loading state.
  • Use for short waits and prefer Skeleton when layout should be reserved.
  • Use one loading announcement per region; decorative Spinner does not create a nested status.
  • Spinner stops rotating when reduced motion is requested and remains visible as a static loading mark.

API

PropTypeDescription
size"sm" | "md" | "lg"Defaults to md.
labelstringRequired localized text for standalone Spinner.
decorativebooleanRemoves status semantics when a parent already announces loading.
classNamestringAdds a semantic foreground color inherited through currentColor.

Implementation contract

ItemContract
Registry itemspinner installs three source files into the configured components directory.
Base UINo interactive primitive required.
Registry dependenciesNone.
Package dependenciesclsx, react

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Spinner indicates short indeterminate loading activity without changing surrounding layout.

Do / do not

Do

Use Spinner for quick work such as saving, filtering, or refreshing. Use currentColor through semantic text color or className to match the surrounding foreground.

Do not

Do not use Spinner for long tasks where determinate Progress is available.

Tokens

These are the primary customization points. Override semantic or component tokens instead of changing component source.

TokenPurpose
--n-spinner-size-smPublic customization point for this component contract.
--n-spinner-size-mdPublic customization point for this component contract.
--n-spinner-size-lgPublic customization point for this component contract.
--n-spinner-border-widthPublic customization point for this component contract.
--n-spinner-durationPublic customization point for this component contract.
--n-radius-fullPublic customization point for this component contract.