AI Response
Present generated answers with streaming, sources, control and recovery, so users can trust and verify them.
9 states7 edge casesDesktop + Mobile
01The problem
Generated responses arrive slowly, can be wrong, and may be long. Users need to see progress immediately, stop generation that is going the wrong way, judge how far to trust the answer, and act on it — copy, insert, retry — without losing what they had.
02When to use
Use when
- Assistants and copilots answering questions over product or document data
- Generating drafts: emails, summaries, descriptions, code
- Search experiences that synthesise an answer above results
- Any feature where a model's output is shown directly to users
Avoid when
- The output is a single structured value, such as a category or a tag — show the result, not a chat bubble.
- Responses take under ~500ms; streaming adds visual noise without benefit.
- The output triggers an action automatically. Use a review-and-confirm pattern instead.
03Recommended UX
Statecraft recommendation
Stream the response into a stable container that does not move the user's scroll position, show a Stop control for the entire duration of generation, and attach sources and actions only once the response is complete.
04Desktop behaviour
On desktop the response sits in a readable column with actions on hover/focus and sources inline as numbered references.
Desktop rules
- Keep the response column under ~720px wide even in wide layouts.
- Show citations as numbered markers inline, with a source list below the response.
- Reveal Copy / Regenerate / feedback on completion, always visible on the latest response and on hover for older ones.
- Regenerating keeps previous versions navigable: “2 / 3”.
05Mobile behaviour
On mobile the keyboard takes half the screen and hover doesn't exist. Responses need full width and always-visible, compact actions.
Mobile rules
4 mobile rules are included in Pro.
Statecraft Pro
Unlock the full pattern
Get the complete interaction flow, states, edge cases, mobile rules and implementation prompt.
- Interaction flow · 6 steps
- 4 mobile rules
- 9 states
- 7 edge cases with recommendations
- 5 microcopy comparisons
- Accessibility notes
- Developer notes
- Claude Code / Codex implementation prompt
- React + TypeScript reference code and tests
Edge cases covered in this pattern
- User scrolls up during streaming
- Stream fails midway
- Answer without sources
- Very long responses
- Regenerate after edits
- Rate limited or quota reached
- Harmful or refused output