Loading States
Patterns for communicating loading progress, keeping users informed, and maintaining perceived performance.
Instant
<100ms — No indicator needed. Action feels immediate.
Brief
100ms–1s — Use spinner. Show after 200ms delay.
Moderate
1–10s — Use skeleton or progress. Keep user engaged.
Extended
>10s — Show progress %, allow background or cancel.
Spinners
Use spinners for short, indeterminate loading states where you can't show progress.
Button loading
Disable button and show spinner during action
Inline loading
Small spinner next to content being updated
Centered spinner
Full container loading state
Loading content...
Overlay spinner
Blocks interaction while loading
Content underneath
Spinner Best Practices
Do
- Add 200ms delay before showing spinner
- Include loading text for context
- Disable interactive elements during load
- Use appropriate size for context
Don't
- Show spinner for very fast operations
- Use spinner for >10 second operations
- Stack multiple spinners
- Leave users without cancellation option for long loads
Skeletons
Use skeleton screens to show the layout structure while content loads. Reduces perceived loading time.
Card skeleton
Placeholder for card-based content
List skeleton
Placeholder for list items
Text skeleton
Placeholder for text content
Image skeleton
Placeholder for images/media
Skeleton Guidelines
- Match the layout: Skeleton should closely mirror the actual content structure and dimensions
- Use subtle animation: A gentle pulse or shimmer effect indicates loading without being distracting
- Avoid text labels: The shape itself should communicate what's loading, not placeholder text
- Load progressively: Replace skeletons with real content as it arrives, don't wait for everything
Progress Indicators
Use progress bars when you can calculate or estimate how much of the operation is complete.
Determinate progress
Shows exact progress percentage
Indeterminate progress
Shows activity without known duration
Multi-step progress
Shows progress through multiple stages
Upload progress
File upload with cancel option
2.3 MB of 5.1 MB
Optimistic Updates
Show changes immediately while saving in the background. Roll back if the save fails.
When to Use Optimistic UI
Good candidates
- • Toggling favorites/likes
- • Marking items as read/complete
- • Reordering lists
- • Editing inline content
- • Deleting items (with undo)
Not recommended
- • Payment transactions
- • Creating new resources
- • Actions that send emails/notifications
- • Anything requiring validation
- • Irreversible destructive actions
Optimistic Update Flow
// 1. Update UI immediatelysetTasks(tasks.map(t => t.id === id ? { ...t, completed: true } : t))
// 2. Make API call in backgroundtry { await updateTask(id, { completed: true })} catch (error) { // 3. Roll back on failure setTasks(originalTasks) toast.error('Failed to update task')}Failed Loading States
Always provide a way to recover when loading fails.
Retry option
Let users try again after failure
Failed to load
Check your connection and try again
Partial failure
Some content loaded, some failed
Successfully loaded content
Failed to load comments
Loading Pattern Decision Tree
| Duration | Pattern | Example Use Case | Notes |
|---|---|---|---|
| <100ms | None | Button click | Feels instant |
| 100ms–1s | Spinner | Form submission | Show after 200ms delay |
| 1–5s | Skeleton | Page load | Match content structure |
| 5–30s | Progress bar | File upload | Show percentage |
| >30s | Background task | Video processing | Email when done |