Spinner
A loading indicator with Apple-style ticks or a breathing ring that can wait before showing and stay long enough not to flicker.
pnpm dlx shadcn@latest add https://hextaui.com/r/spinner.jsonAdds the component, the HextaUI theme tokens and any HextaUI components it depends on.
Add the theme tokens to your global CSS, if you haven’t yet.
Install the dependencies.
pnpm add class-variance-authority cnCopy and paste the following code into your project.
components/ui/spinner.tsx Update the import paths to match your project setup.
The default is the eight-spoke indicator from Apple platforms. variant="ring" spins while its arc grows and shrinks, so it reads as working rather than stuck. Both are drawn in the current text color.
Without flicker
Pass loading and the spinner waits delay (150ms) before showing, so fast loads never flash it, then stays at least minDuration (400ms) once it's visible.
Sizes
sm, default, lg and xl for both variants.
Inline
Next to text, mark the spinner aria-hidden so the words do the talking. On its own, it announces its label.
Saving changes…
Spinners use the text color around them.
In buttons
Button and Command use this spinner for their loading states, sized to the button's icons.
- On its own, the spinner is a
statusnamed bylabel(“Loading”). - With
aria-hidden, it drops its role, for use beside visible text or inside a busy button. - With reduced motion, it gently pulses instead of spinning, so it still shows that something is happening.
| Prop | Type | Default |
|---|---|---|
variant | "ticks" | "ring" | "ticks" |
sizenull leaves sizing to the parent. | "sm" | "default" | "lg" | "xl" | null | "default" |
label | string | "Loading" |
loadingTurns on delayed showing. Leave it out to always show. | boolean | – |
delay | number | 150 |
minDuration | number | 400 |
animatedPause the animation without hiding it. | boolean | true |
| Attribute | Description |
|---|---|
data-slot="spinner" | The SVG, with data-variant. |
The same timing as a hook, for skeletons, overlays or anything else that shouldn't flash. See the useDelayedLoading guide.