---
name: loading-states
description: Use when designing waiting moments such as skeletons, spinners, progress bars, optimistic updates and AI "thinking" indicators.
---

# Loading states

Waiting feels shorter when the interface shows progress and keeps its shape.

## Choose by wait time

| Expected wait | Show |
| --- | --- |
| Under 300ms | Nothing; avoid flashes |
| 300ms to 2s | Skeleton or inline spinner |
| 2s to 10s | Progress bar or step labels |
| Over 10s | Progress with time estimate and a way to cancel |

Delay spinners by about 300ms so fast responses never flash a loader, and keep them visible at least 400ms once shown.

## Skeletons

- Match the real layout exactly so nothing jumps when content arrives.
- Use a soft shimmer that moves left to right every 1.2-1.6s.
- Cross-fade skeleton to content over 200ms.

## Progress inside the control

- Show progress in the button or row that started the task (fill the button background, label changes to "Saving…").
- When done, morph to a check mark, then return to normal after about 1.5s.

## Optimistic UI

- Apply the change instantly, sync in the background, and roll back with a small shake and message if it fails.

## AI thinking indicators

- Use a calm, looping animation (pulsing dots, shimmering label, small orb) and update the label with real steps ("Searching…", "Writing…").

## Rules

- Never block the whole page for a partial load.
- Announce status with `role="status"` or `aria-live="polite"`.
- Reduced motion: keep spinners and progress, drop shimmer and pulses.
