Chat messages
Chat messages are the fundamental building block of a conversational interface. The thread aligns each message to one side — the user to the end, the AI assistant to the start — and a bot message can offer a short list of suggestions to move the conversation forward.
Quarantine
Chat messages facilitate the exchange of information between an AI assistant and a user in a structured, readable format. The thread distinguishes the two speakers by side and treatment: the user’s input sits in a bubble at the end, while the assistant’s reply is open text at the start, marked by a sparkle and optionally followed by suggestions.
Anatomy
Section titled “Anatomy”- Chat Messages
- User message
- Bot message
- AI icon
- Suggestions
When to use it
Section titled “When to use it”Use chat messages when:
- You’re building a chatbot or virtual-assistant interface.
- You need to display a real-time dialogue between the system and the user.
- The assistant presents information, recommendations, or follow-up questions, and may offer the user a few ready-made replies.
Avoid chat messages when:
- The content is a static block of copy with no back-and-forth — use the content or list components.
- You need a form or a single prompt-and-response — a field with a label is clearer than a faked conversation.
Properties
Section titled “Properties”Type
Two types, set by which class you reach for. The user message is a bubble aligned to the end of the thread; the bot message is open text aligned to the start. The thread container aligns each automatically — there is no alignment modifier to set.
AI icon
A bot message is preceded by a decorative sparkle icon that identifies the content as AI-generated. It is purely visual — it carries no text and is hidden from assistive technology.
Suggestions
A bot message can be followed by a short list of Chip suggestions — ready-made replies the user can pick to continue the conversation. Keep the list short; they’re a shortcut, not a menu.
Platform considerations
Section titled “Platform considerations”Desktop
Messages cap at a readable line length (≈ 558px) and never span the full width of a wide panel, so long replies stay scannable. Place the thread inside a panel with a subtle surface so the user bubble reads.
Tablet
The same width cap applies. Suggestions wrap onto two lines as the thread narrows — that’s expected; don’t truncate them.
Mobile
Messages narrow with the thread and keep a margin on the far side so the user / bot sides stay legible. The bubble’s squared corner stays on the user side, mirroring in right-to-left layouts.
Best practices
Section titled “Best practices”The thread is transparent — it inherits the surface it’s placed on. Give it a subtle background (a chat panel) so the user bubble separates from the page in the default scheme.
Do
Keep messages short and front-load the answer. Use a handful of suggestions at most, phrased as the user would say them. Let the thread sit on a subtle surface so the bubbles read.
Don't
Don’t place the thread directly on a pure-white page in the default scheme — the white user bubble disappears. Don’t pad the thread with dozens of suggestions, and don’t use it for one-shot prompts where a form field fits better.
Content guidelines
Section titled “Content guidelines”Chat copy should feel conversational, efficient, and human, even when it comes from a bot.
- Tone and voice: Be human, not robotic — use natural language and active voice. Instead of “Processing request”, say “Give me a moment while I look that up.”
- Clarity: Front-load the most important information or the answer at the beginning of the message. Keep messages short; break long explanations into separate bubbles.
- Punctuation: Avoid ALL CAPS (use bolding for emphasis), limit emoji, and skip multiple exclamation or question marks.
- Perspective: The bot refers to itself as “I” and the user as “you”.
Styles
Section titled “Styles”A thread is a .tng-chat-messages wrapper holding .tng-user-message and .tng-bot-message children — each self-aligns, so you never set alignment yourself. Place the thread on a subtle surface (here background-subtle) so the user bubble reads in the default scheme. Message text is the Body 5 style (tng-text-body is-5).
<div class="tng-chat-messages" role="log" aria-live="polite" aria-atomic="false"> <div class="tng-user-message"> <p class="tng-text-body is-5"> Hi, I'm deciding between the Lexus UX and the LBX. Can you help me compare them? </p> </div> <div class="tng-bot-message"> <p class="tng-text-body is-5"> <i class="tng-icon icon-ai-sparkle" aria-hidden="true"></i> Can I clarify the size of the pram so that I can give you a more precise recommendation? </p> <ul class="tng-bot-message-options"> <li> <button type="button" class="tng-chip is-suggestion"> <span> What are the different grades available for the Lexus LBX? </span> <i class="tng-icon icon-ui-arrow-right" aria-hidden="true" ></i> </button> </li> <li> <button type="button" class="tng-chip is-suggestion"> <span>How do the running costs compare?</span> <i class="tng-icon icon-ui-arrow-right" aria-hidden="true" ></i> </button> </li> </ul> </div></div>User message
Section titled “User message”A bubble aligned to the end of the thread. The surface and text colour ride the scheme; the bottom corner on the user’s side is squared to anchor the bubble.
<div class="tng-chat-messages"> <div class="tng-user-message"> <p class="tng-text-body is-5"> Hi, I'm deciding between the Lexus UX and the LBX. Can you help me compare them? </p> </div></div>Bot message
Section titled “Bot message”Open text aligned to the start, preceded by the decorative sparkle. No bubble.
<div class="tng-chat-messages"> <div class="tng-bot-message"> <p class="tng-text-body is-5"> <i class="tng-icon icon-ai-sparkle" aria-hidden="true"></i> Can I clarify the size of the pram so that I can give you a more precise recommendation? </p> </div></div>Suggestions
Section titled “Suggestions”Follow a bot message with a .tng-bot-message-options list of Chip buttons. Each is a real <button>, so it’s keyboard-focusable and announced as part of a list.
<div class="tng-chat-messages"> <div class="tng-bot-message"> <p class="tng-text-body is-5"> <i class="tng-icon icon-ai-sparkle" aria-hidden="true"></i> Here are a few things I can help with. </p> <ul class="tng-bot-message-options"> <li> <button type="button" class="tng-chip is-suggestion"> <span>Compare the UX and the LBX</span> <i class="tng-icon icon-ui-arrow-right" aria-hidden="true" ></i> </button> </li> <li> <button type="button" class="tng-chip is-suggestion"> <span>Book a test drive</span> <i class="tng-icon icon-ui-arrow-right" aria-hidden="true" ></i> </button> </li> <li> <button type="button" class="tng-chip is-suggestion"> <span>See current offers</span> <i class="tng-icon icon-ui-arrow-right" aria-hidden="true" ></i> </button> </li> </ul> </div></div>Chat messages render a conversational thread between a user and an assistant. It follows the WAI-ARIA log role — a live region that announces new messages as they arrive — and meets WCAG 2.1 AA. An accessible chat thread announces each new message without re-reading the history, keeps its visual order and DOM reading order in sync, and distinguishes the assistant from the user by more than colour — so the conversation is clear whether the user sees it, hears it, or tabs through it.
For designers
Section titled “For designers”- Visual distinction: Ensure a clear visual difference — alignment and colour — between the bot and the user, so people with cognitive disabilities can follow the flow. Side alone isn’t enough; the bubble vs. open-text treatment carries the difference too. The same applies to the sparkle marking AI-generated content: it’s decorative, so never rely on it alone to convey “this is the assistant.” Source: WCAG 1.4.1 Use of Color.
- Contrast: The user bubble’s text must keep a contrast ratio of at least 4.5:1 against the bubble surface, in both the default and contrast schemes. Source: WCAG 1.4.3 Contrast (Minimum).
- Focus: The suggestion buttons’ focus styles must stay visible, meet contrast requirements, and be clearly distinguishable from hover. Source: WCAG 2.4.7 Focus Visible.
- Typography: Message text uses a legible size (18px, Body 5) to stay readable for users with low vision, and colours come from semantic tokens so the thread adapts correctly across themes and surfaces.
For developers
Section titled “For developers”The thread is a live region. Mark the wrapper so a screen reader announces new messages as they arrive without re-reading the whole history:
<div class="tng-chat-messages" role="log" aria-live="polite" aria-atomic="false"></div>Consumer responsibilities
Section titled “Consumer responsibilities”aria-atomic="false": Set on the wrapper so only the newly added message is announced, not the entire conversation, every time a bubble appears.- Focus & reading order: Append messages in chronological order in the DOM (oldest first, newest last) so the focus and screen-reader order matches the visual order. Source: WCAG 1.3.2 Meaningful Sequence.
- Interactive elements: Suggestions are real
<button>s, so they’re reachable via Tab out of the box. If a message contains a link, make sure it’s reachable too. - Scroll management: When a new message arrives, don’t auto-scroll to it unless the user is already at the bottom of the thread — yanking the viewport disorients someone reading earlier history.
- Decorative icon: Keep the sparkle
aria-hidden="true"; it adds nothing for assistive tech.
Keyboard
Section titled “Keyboard”| Key | Action |
|---|---|
| Tab | Move to the next suggestion (or link) in the thread |
| Shift + Tab | Move to the previous suggestion (or link) |
| Enter / Space | Activate the focused suggestion |
See the WAI-ARIA log role and live region guidance for the announcement behaviour.