An AI chat interface looks simple: a text box and a list of messages. The difficulty is in the states. A reply can be sending, streaming, stopped, failed or complete; the composer can be empty, busy or queuing; a conversation can be three turns long or three hundred. Good chat UI is mostly the careful handling of those states.
This article walks through each part of a chat interface, the states it has to handle, and the details that separate a usable one from a demo. If you are designing an agent rather than a question-and-answer assistant, read it alongside the guide to agentic UI design.
Anatomy
A chat interface has five parts, each with its own job:
| Part | Job | States |
|---|---|---|
| Composer | Write and send a request, with context | Empty, ready, sending, working (Stop), disabled |
| Message | One turn, from the person or the assistant | Streaming, complete, stopped, failed |
| Message actions | Act on a reply: copy, retry, edit, rate | Hidden while streaming, then available |
| Suggested replies | Offer likely next steps | Shown after a complete reply, gone once used |
| Context | Show what the assistant can see | Attached, removed, too large |
Try them together. Send the prompt, stop it midway, or let it finish:
The composer
The composer is the most used control in the product, so its behaviour has to be predictable to the point of being invisible.
- Enter sends, Shift+Enter adds a line. This is the convention in nearly every chat product. Keep it, and don’t send while an input method editor is composing characters.
- The send button becomes Stop. While a reply is being written, the most useful action is stopping it. Putting Stop where Send was means people don’t have to look for it. Escape should do the same.
- Disable send only when there’s nothing to send. An empty box is the one honest reason. A disabled button with no explanation is a dead end.
- The text box grows with the request up to a sensible height, then scrolls. Long prompts are common and should stay editable.
- Keep the draft. If sending fails, the text stays in the box. Losing a long prompt to a network error is one of the fastest ways to lose trust.
Attuna’s Prompt Input handles the keyboard, Stop and sizing rules, including not sending mid-composition. Keeping the draft after a failed send is up to your app. The component deliberately knows nothing about models or streaming: you pass it a status and callbacks from whatever runtime you use.
Attachments and context
What the assistant can see shapes what it says. Show attached files and referenced items as chips above the text, each removable, so people can check the context before they send. Distinguish between a file the person uploaded and something the product added automatically, such as the current page or project. A Context Chip keeps those references compact and consistent.
Messages and hierarchy
The person’s messages and the assistant’s replies have different jobs, so they should look different. A common, effective layout puts the person’s short messages in a quiet bubble aligned to the right, and the assistant’s replies as full-width text without a container. Replies are often long and contain lists, code and tables; boxing them in reduces the reading width for no benefit.
Avatars and names add little in a two-party conversation. They earn their place when several agents or people take part. Timestamps belong on hover or in a quiet line, not on every message.
Streaming
Streaming the reply as it’s generated makes long answers feel faster and gives people a chance to stop a reply that’s going the wrong way. It also creates states that a finished message never has:
- Streaming shows a small working mark and a caret at the end of the text, so people can tell an unfinished sentence from a finished one.
- Stopped keeps what was written and says “Stopped”. Deleting the partial reply hides information; pretending it completed misleads.
- Failed says the reply couldn’t finish, in plain language, with a retry nearby.
Avoid scroll hijacking. If a person scrolls up while a reply streams, stop auto-scrolling until they return to the bottom, and offer a way to jump there.
After the reply
Once a reply is complete, two kinds of follow-up become useful. Message actions act on the reply itself: copy, retry, edit the prompt, read aloud, rate. Keep them quiet, in a small row beneath the reply, and don’t show them while it’s streaming, when most of them don’t make sense. Attuna’s Message Actions follows that rule.
Suggested replies offer likely next steps. They work when they are specific to the answer (“Draft the new order”) and fail when they are generic (“Tell me more”). Three is usually enough. Remove them once the conversation moves on, so stale options don’t pile up. See Suggested Replies.
Errors
Chat products fail in a handful of recurring ways. Each deserves its own message:
- The request didn’t send. Keep the draft, explain briefly and offer to try again.
- The reply stopped partway. Keep the partial text, mark it as incomplete, offer retry.
- A limit was reached. Say which limit and when it resets, ideally before the request fails rather than after.
- The model refused or couldn’t help. That is a reply, not an error. Style it as a normal message.
Error text should name what happened and what to do. “Something went wrong” only tells people that you know something went wrong.
Long conversations
Conversations grow, and the interface has to stay usable as they do.
- Keep the reading width fixed as the window widens. Around 65 to 75 characters per line is comfortable for prose.
- Make earlier turns findable: a list of past conversations, search, and titles that describe the topic.
- Show context use when it matters. Models have a finite context window; when a conversation approaches it, say so and offer to summarise or start fresh, instead of letting quality quietly degrade.
- Render lazily once conversations run to hundreds of messages, but keep the text searchable with the browser’s find.
Mobile
On phones the composer competes with the on-screen keyboard for most of the screen. Keep it pinned above the keyboard, keep the send button inside the box rather than beside it, and make sure targets meet the WCAG 2.2 minimum target size of 24 by 24 CSS pixels; 40 or more is more comfortable for frequent actions. Because Enter on a mobile keyboard usually means a new line, a visible send button is essential there. Attachment and context chips should scroll horizontally rather than pushing the text box off screen.
Accessibility
Chat is a hard case for screen readers, because content changes constantly and often far from the focus. A few rules go a long way:
- The message list is a log. The ARIA
logrole is designed for sequential updates such as chat, and is polite by default (W3C ARIA23). - Don’t announce every token. Announcing a reply word by word as it streams is noisy and hard to follow. Mark the message as busy while it streams, and announce short status changes, such as writing, stopped or failed, from a separate status element. That is what WCAG’s status messages criterion is about. Attuna’s Message sets
aria-busywhile streaming and keeps its state text in its own status region. - Keep focus in the composer after sending. People who send several messages in a row shouldn’t have to find the box again.
- Label icon buttons. Copy, retry and rate need accessible names, and their results need confirmation (“Copied”).
When chat is the wrong interface
Chat is a good default when the request is open-ended and the answer is mostly words. It is a poor fit when:
- The task has a known structure. Booking, configuring or filing something is faster in a form, even one the AI pre-fills.
- People need to compare. Options belong in a table or side by side, not in paragraphs.
- The output is the interface. If the result is a document, a design or code, the conversation should sit beside the artefact, not contain it.
- The action is repeated. Typing the same request every day is a sign it should be a button.
The comparison of generative and conversational UI takes that question further, and the guide to AI loading states covers what to show while a reply is on its way.