Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Spinner examples · Standard

Primary Color Spinner for React

A spinner in the primary color for a branded loading state.

Framework
UI library

A spinner can carry the brand color when the wait is the main thing on screen. This Spinner takes text-primary, so it follows your theme's primary token, in light and dark mode.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How does this spinner use the primary color?

Pass text-primary on Spinner. The icon draws with currentColor, so the text class paints the stroke. This file sets that class and nothing else.

Does text-primary follow the theme?

Yes. text-primary reads the same token as primary text elsewhere, including in light and dark mode. Change the token and this spinner follows.

What size is the primary spinner?

It stays at the default size-4 (16px). Add size-3, size-6, or size-8 on the same element to resize it. The color class stays put.

How do I use this color inside a button?

Put the Spinner in the Button with data-icon set to inline-start, and disable the button while the work runs. A filled button already sets its own text color, so the spinner picks that up through currentColor. Add text-primary when the spinner sits outside a button, as this file does.

Does the primary color change the announcement?

No. The spinner still has role="status" and an aria-label of Loading. Pass your own aria-label to name the work, and keep a visible label when the wheel is the only cue.

How do I stop the spin for reduced motion?

The spin is animate-spin. Add motion-reduce:animate-none beside text-primary and the icon stays still. The status role and the label stay.