React Loading Spinner
A React loading spinner for work with no known length, announced politely and held still as a static arc under reduced motion. Use Spinner as a loading indicator in React for a wait with no known length, such as a route transition, a panel waiting for data or a search that has just been submitted.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/spinner.jsonSyncing files
Syncing 24 files
This takes as long as it takes.
SpinnerdefaultSpinnerLabels
Sizes, tones and loading buttons
Five sizes on glass with their names, a labelled panel, muted and current-colour tones, and a row of busy buttons. showLabel prints the text; the label is always read aloud.
Loading
xsLoading
smLoading
mdLoading
lgLoading
xlLoading your projects
The label is read aloud as "Loading your projects" and shown under the ring.
LoadingMuted, for quiet panels
LoadingCurrent colour, on a filled surface
import { Button } from "@/components/sheenui/button/button";
import { Spinner } from "@/components/sheenui/spinner/spinner";
// Package build (after the first npm release, or a packed tarball): import { Button, Spinner } from "@sheenui/theme";
// This example also uses button: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json
export function Example() {
return (
<div className="flex w-full flex-col gap-4">
<div className="glass-2 grid grid-cols-5 gap-3 rounded-sheen-xl p-5">
{(["xs", "sm", "md", "lg", "xl"] as const).map((size) => (
<div key={size} className="flex flex-col items-center gap-3">
<Spinner size={size} />
<span className="text-xs font-medium text-sheen-fg-muted">{size}</span>
</div>
))}
</div>
<div className="glass-2 flex flex-col items-center gap-3 rounded-sheen-xl p-6">
<Spinner size="xl" showLabel labels={{ loading: "Loading your projects" }} className="flex-col" />
</div>
<div className="glass-2 flex flex-wrap items-center gap-3 rounded-sheen-xl p-5">
<Button aria-busy disabled>
<Spinner size="sm" tone="current" labels={{ loading: "Saving" }} />
Saving
</Button>
<Button variant="glass" aria-busy disabled>
<Spinner size="sm" tone="current" labels={{ loading: "Syncing" }} />
Syncing files
</Button>
<Button loading>Button prop</Button>
</div>
</div>
);
}Files to copy
3 folders · 1 file · 4 packages
- From
theme/src/ components/spinner/lib/cn.tsstyles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/spinner.jsonRegistry item: spinner. The styles need the Tailwind v4 glass UI setup.- The examples also use
components/button/hooks/{use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}motion/{gate.ts, tokens.ts}lib/{form.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Props
SpinnerLabels keys and English defaults (1)
All exports on this page
Spinner— A loading spinner for something that has no known length (a button, a panel, a route).defaultSpinnerLabels— The English SpinnerLabels used when labels is omitted; a partial labels prop is merged over it.
Keyboard
Accessibility
- It is a role="status" live region with a visually hidden label ("Loading" by default), so mounting it announces politely. Remove it when the work is done.
- The ring itself is aria-hidden. Use labels.loading to say what is loading, in the page language.
- Reduced motion (OS setting or the in-app toggle) keeps the arc turning, slower: it is the loading signal itself. Everything else about the page stops moving.
- The track keeps 3:1 against the surface; forced colors draw it in CanvasText.
When to use Spinner
- Use Spinner next to a Saving label or inside a disabled button while a request runs and you cannot say how long it will take; switch to Progress once you can report how far along it is.
- Use showLabel to print the word Loading next to the ring in an empty state, and keep the default hidden label for places where the ring alone is clear.
- Use tone current to inherit the surrounding text color inside a button or a badge, and the xs or sm sizes to fit a line of text.
- Skip it when the task has a measurable end, where Progress fits, or when you know the shape of the incoming content, where Skeleton gives a calmer placeholder.
- Pair it with Button, which shows its own spinner through the loading prop, useOffscreenLoops near the app root to pause off-screen loops, and EmptyState for a loading panel.
Frequently asked questions
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .