--- title: States slug: states prefix: STATE order: 2 summary: Empty, loading, error and edge-case states, beyond the happy path that agents tend to stop at. --- AI agents usually build the screen with perfect data. Real people meet the empty, slow and broken versions first. ## STATE-01: Design every view for empty, loading, error and success - **Level:** MUST - **Why:** The happy path is one state out of at least four. The missing ones are the ones people remember. - **Do:** Before calling a view done, build and preview its empty, loading, error and success states. - **Don't:** Ship a list that only works once data exists. - **Check:** walkthrough - **Test:** Force each state (no data, slow network, failed request) and confirm each has a deliberate design. ## STATE-02: Empty states explain what goes here and offer the next step - **Level:** MUST - **Why:** An empty screen is a new user's first impression. It should teach, not shrug. - **Do:** Say what will appear and add the action that fills it, for example "No projects yet" with a "Create project" button. - **Don't:** Show a blank area, "No data" or a lonely table header. - **Check:** walkthrough - **Test:** Open each list or dashboard with no data. Each shows an explanation and a primary action. ## STATE-03: Loading keeps the layout stable - **Level:** MUST - **Why:** Content that jumps as it loads makes people click the wrong thing and feels broken. - **Do:** Reserve space for content and images. Use skeletons shaped like the final layout for waits longer than about 300 ms. - **Don't:** Flash a spinner for 50 ms, or let content push the page down when it arrives. - **Check:** auto - **Test:** Cumulative Layout Shift stays below 0.1, and images have width and height or an aspect ratio set. ## STATE-04: Errors explain what happened and offer a way out - **Level:** MUST - **Why:** A dead end makes people leave. A clear message and a retry keeps them going. - **Do:** Say what failed in plain words, keep the rest of the page usable, and offer "Try again" or another route. - **Don't:** Show "Error 500", a stack trace or a white screen. - **Check:** walkthrough - **Test:** Block the API and confirm the view shows a human message with a retry, and the rest of the app still works. ## STATE-05: Handle real-world content - **Level:** SHOULD - **Why:** Demo data is short and tidy. Real names are long, lists hold a thousand items, and images fail to load. - **Do:** Test with 0, 1 and 1,000 items, 60-character names, missing images and large numbers. Truncate with a tooltip or wrap on purpose. - **Don't:** Let a long name break the layout or overlap buttons. - **Check:** walkthrough - **Test:** Load stress data and look for overflow, overlap and broken images.