Loading states
Shows that work is in progress, keeps the page stable and tells people how long to expect.
Waiting is part of every product. A loading state keeps the person oriented: it shows what is coming, what is happening now and, when it can be measured, how far along it is. It chooses the lightest signal that is honest about the wait.
Anatomy
- Skeleton for content that will appear in a known shape.
- Spinner for a short action with no measurable end, always with words beside it.
- Progress for work that can be measured, with a label and a value.
- Button with
isPendingfor the action that started the wait. - Table with real headers and skeleton cells, so columns do not move when data arrives.
Page load
The page paints its real structure at once: title, labels and table headers. Only the values are skeletons, sized like the content that replaces them. A control replays the load.
Choose it for the first load of a view that has a stable layout. Use the real labels wherever you know them.
In-place loading
Four cases that keep the page in place: a pending button, a table that refreshes while its rows stay visible, a long export with progress and a way to cancel, and text that streams in with a way to stop it.
Choose it for anything after the first load. Never blank the screen to refresh part of it.
Behaviour
- Under a second. Show nothing. A flash of skeletons is worse than a short wait.
- One to ten seconds. Skeletons for content, a pending button for actions.
- Over ten seconds. Show progress if it can be measured, say what is happening, offer Cancel and say if the person can leave.
- Layout. A skeleton has the size of the final content, so nothing jumps.
- Replay and error. Every loading state has an end: content, or an error with a way to retry (see Error states).
- Motion. The pulse stops when the person asks for reduced motion.
Accessibility
- The container has
aria-busywhile it loads, and a status region says Loading and then Loaded in words that only screen readers see. - A spinner always sits beside text, and a progress bar has a label and a value.
- Streaming text is not announced word by word. A status announces when it starts, stops or finishes.
- A pending button stays focusable, so focus is not lost, and ignores presses.
Content
- Say what is happening in the present tense: "Exporting purchase ledger 2026", "Sending order".
- Give numbers when you have them: "424 of 1,284 rows".
- Do not invent progress. If you cannot measure it, use a spinner and words.
Work order WO-5108
Keep the labels you know and make skeletons the size of the content.
Don’t show a lone spinner that says nothing and shifts the layout when it ends.
Install
pnpm dlx shadcn@latest add @silkware/loading-states-01pnpm dlx shadcn@latest add @silkware/loading-states-02