Spinner: 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.
This adds the example as components/examples/spinner/delayed.tsx, together with the Spinner component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/spinner-delayed.jsonTo add only the component, follow the Spinner installation.
Props in this example
The Spinner props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
sizenull leaves sizing to the parent. | "sm" | "default" | "lg" | "xl" | null | "default" |
loadingTurns on delayed showing. Leave it out to always show. | boolean | – |
Every prop is in the Spinner API reference.
See them all, with keyboard support and accessibility notes, on the Spinner page.
- useDelayedLoadingShows a loading state only when work is actually slow, then keeps it up long enough that it never flickers.
- AlertInline messages for status and feedback, with a neutral surface, a colored icon and a dismiss that collapses smoothly.
- EmptyA placeholder for screens with nothing to show yet, with an icon, a message and the next action.
- ProgressA bar or ring that shows how far a task has come, eases between updates and slides while the total is unknown.
- SkeletonPlaceholders that wait 150ms before showing, take the exact size of the content they wrap, and fade it in without moving anything.
- ToastBrief messages that stack neatly, expand on hover, swipe away, and turn a loading state into success or error in place.