When to Use
- Use when: building any component that loads data from an API or async source
- Use when: a view shows a blank screen, spinner, or broken layout during load
- Use when: error messages are technical or give no recovery path
- Use when: pre-ship checklist for any data-dependent screen
The 7-State Lifecycle
Every data-dependent view must handle all 7. Missing states are bugs, not edge cases.
| State |
What it is |
Design goal |
| Empty |
No content yet — brand new account, cleared list |
Guide and motivate — "what do I do first?" |
| Loading |
Request in flight, duration unknown |
Reassure — something is happening |
| Skeleton |
Placeholder shapes matching content layout |
Reduce perceived wait — structure before data |
| Partial |
Some data arrived, rest still loading |
Progressive enhancement — must look intentional |
| Complete |
All data loaded, all interactions available |
Happy path — the designed state |
| Error |
Something failed: network, auth, validation, rate limit |
Recovery — tell what, why, and what to do next |
| Offline |
Network lost |
Graceful degradation — cached content + queue writes |
Per-State Rules
Empty
Two types — design both separately:
- First-use empty: answers "What is this?" + "What do I do first?" → illustration + explanation + primary CTA
- No-results empty: search/filter matched nothing → suggest how to broaden, never just "No results"
Loading
- Brief wait (< 1s): simple spinner is acceptable
- Content-heavy view: skeleton screen preferred — never blank white
- ARIA:
aria-live="polite" region to announce loading to screen readers
Skeleton
/* Pulse animation — matches content dimensions exactly */
.skeleton {
background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
background-size: 200% 100%;
animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
/* Stagger skeleton groups 50ms apart */
Rules: match exact dimensions of real content. Never show more skeleton items than will actually appear.
Optimistic UI
Show the expected result immediately — don't wait for server confirmation.
On failure: smoothly revert + show error toast. Never silently swallow errors.
Use for: like/unlike, follow/unfollow, send message, mark complete.
Error
Three-part requirement — all three are mandatory:
- What happened (plain language — no error codes, no stack traces)
- What it means for the user
- What to do next (retry button, contact support link, or alternative path)
Additional rules:
- Preserve user input — never clear a form on error
- Show cached/stale data with a staleness indicator when available
- Retry button for transient failures (network, timeout, rate limit)
Offline
Offline is a state, not an error. Required:
- Clear disconnection indicator
- Show cached content where available (mark as "last updated X ago")
- Queue write actions silently, sync on reconnect
- Indicate queued actions: "Will send when connected"
Perceived Performance — Three Pillars
Speed users feel matters more than speed they can measure:
- Immediate feedback — acknowledge every action within 100ms (even if just a spinner appearing)
- Visual continuity — maintain spatial relationships during transitions so the brain can track changes
- Progressive disclosure — show something useful as early as possible, then enhance
A 3s load that feels fast (skeleton + progressive render) beats a 2s load that feels slow (blank then content dump).
Audit Checklist
For every data-dependent view before ship:
□ First-use empty state — illustration + explanation + CTA
□ No-results state — helpful suggestion, not just "no results"
□ Loading state — spinner or skeleton chosen appropriately
□ Skeleton matches real content dimensions
□ Partial state looks intentional, not broken
□ Complete (happy path) — fully designed
□ Error state — 3-part message (what / means / do next) + retry
□ Offline state — cached content shown, writes queued
□ ARIA live region on loading indicator
□ Optimistic UI: failure reverts visibly with error feedback
Anti-Fake-Pass Rules
Before claiming a view is done, you MUST show:
Reference: gates/anti-fake-pass-gate.md | gates/ui-quality-gate.md
1---2name: ui-states3description: >4 Design all 7 UI states for any data-dependent view: empty, loading, skeleton,5 partial, complete, error, offline. Use when asked about "loading state",6 "skeleton screen", "error message", "empty state", "optimistic UI", "what7 happens while data loads", or before marking any data-dependent view as done.8 Every view that fetches data must pass all 7 states before ship.9origin: adapted:ux-ui-mastery10license: MIT © phazurlabs11version: 1.0.012compatibility: "Any frontend stack. Framework-agnostic patterns."13metadata:14 source: https://skillmd.com/skills/yanacuti1121/ui-states15---1617<!-- Adapted from phazurlabs/ux-ui-mastery (MIT) — Performance States Patterns skill.18 7-state lifecycle, perceived performance pillars, audit checklist.19 YAMTAM structure, Anti-Fake-Pass gate, and condensed format are original. -->2021## When to Use2223- Use when: building any component that loads data from an API or async source24- Use when: a view shows a blank screen, spinner, or broken layout during load25- Use when: error messages are technical or give no recovery path26- Use when: pre-ship checklist for any data-dependent screen2728---2930## The 7-State Lifecycle3132Every data-dependent view must handle all 7. Missing states are bugs, not edge cases.3334| State | What it is | Design goal |35|---|---|---|36| **Empty** | No content yet — brand new account, cleared list | Guide and motivate — "what do I do first?" |37| **Loading** | Request in flight, duration unknown | Reassure — something is happening |38| **Skeleton** | Placeholder shapes matching content layout | Reduce perceived wait — structure before data |39| **Partial** | Some data arrived, rest still loading | Progressive enhancement — must look intentional |40| **Complete** | All data loaded, all interactions available | Happy path — the designed state |41| **Error** | Something failed: network, auth, validation, rate limit | Recovery — tell what, why, and what to do next |42| **Offline** | Network lost | Graceful degradation — cached content + queue writes |4344---4546## Per-State Rules4748### Empty49Two types — design both separately:50- **First-use empty**: answers "What is this?" + "What do I do first?" → illustration + explanation + primary CTA51- **No-results empty**: search/filter matched nothing → suggest how to broaden, never just "No results"5253### Loading54- Brief wait (< 1s): simple spinner is acceptable55- Content-heavy view: skeleton screen preferred — never blank white56- ARIA: `aria-live="polite"` region to announce loading to screen readers5758### Skeleton59```css60/* Pulse animation — matches content dimensions exactly */61.skeleton {62 background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);63 background-size: 200% 100%;64 animation: shimmer 1.5s ease-in-out infinite;65}66@keyframes shimmer {67 0% { background-position: 200% 0; }68 100% { background-position: -200% 0; }69}70/* Stagger skeleton groups 50ms apart */71```72Rules: match exact dimensions of real content. Never show more skeleton items than will actually appear.7374### Optimistic UI75Show the expected result immediately — don't wait for server confirmation.76On failure: smoothly revert + show error toast. Never silently swallow errors.77Use for: like/unlike, follow/unfollow, send message, mark complete.7879### Error80Three-part requirement — all three are mandatory:811. **What happened** (plain language — no error codes, no stack traces)822. **What it means for the user**833. **What to do next** (retry button, contact support link, or alternative path)8485Additional rules:86- Preserve user input — never clear a form on error87- Show cached/stale data with a staleness indicator when available88- Retry button for transient failures (network, timeout, rate limit)8990### Offline91Offline is a state, not an error. Required:92- Clear disconnection indicator93- Show cached content where available (mark as "last updated X ago")94- Queue write actions silently, sync on reconnect95- Indicate queued actions: "Will send when connected"9697---9899## Perceived Performance — Three Pillars100101Speed users *feel* matters more than speed they can measure:1021031. **Immediate feedback** — acknowledge every action within 100ms (even if just a spinner appearing)1042. **Visual continuity** — maintain spatial relationships during transitions so the brain can track changes1053. **Progressive disclosure** — show something useful as early as possible, then enhance106107> A 3s load that *feels* fast (skeleton + progressive render) beats a 2s load that *feels* slow (blank then content dump).108109---110111## Audit Checklist112113For every data-dependent view before ship:114115```116□ First-use empty state — illustration + explanation + CTA117□ No-results state — helpful suggestion, not just "no results"118□ Loading state — spinner or skeleton chosen appropriately119□ Skeleton matches real content dimensions120□ Partial state looks intentional, not broken121□ Complete (happy path) — fully designed122□ Error state — 3-part message (what / means / do next) + retry123□ Offline state — cached content shown, writes queued124□ ARIA live region on loading indicator125□ Optimistic UI: failure reverts visibly with error feedback126```127128---129130## Anti-Fake-Pass Rules131132Before claiming a view is done, you MUST show:133- [ ] All 7 states identified — none marked "not applicable" without reason134- [ ] Empty state: first-use AND no-results designed separately135- [ ] Error state: shows what happened + what to do (not just a red banner)136- [ ] Offline state: cached content strategy stated137- [ ] ARIA live region present on loading indicator138139Reference: `gates/anti-fake-pass-gate.md` | `gates/ui-quality-gate.md`