Chat
Introduction
Section titled “Introduction”A conversation view for an AI assistant or for people. It shows user, assistant, system, and tool messages with avatars and timestamps; day separators read “Today”, “Yesterday”, a weekday, or a date, and name holidays and non-working days from a business calendar. Assistant replies stream from a host-supplied AsyncIterable<string> or ReadableStream<string>, with Stop (an AbortSignal for the request) and Retry. It has a typing indicator, per-message errors, attachments as file chips, suggestion chips, copy and thumbs up/down actions, and auto-scroll that pauses while the user reads earlier messages, with a “Jump to latest” button. Text renders as plain text or as a safe Markdown subset; model output is never parsed as HTML. The composer is a Prompt Input.
- Streaming repliesPass any AsyncIterable or ReadableStream of text; Stop aborts the request through an AbortSignal, and Retry restarts the same message.
- Safe MarkdownHeadings, lists, links, and code blocks from a built-in subset. Model output is never parsed as HTML, and only http(s) links render.
- Calm for screen readersA role=log conversation that announces each finished reply once, never every streamed token.
- Reads like a conversationAvatars, times, and day separators that name holidays and non-working days from your business calendar.
- Actions on every replyCopy, thumbs up and down, attachment chips, and suggestion chips, all reachable by keyboard and reported as events.
- Long conversationsAuto-scroll pauses while you read earlier messages, with Jump to latest; the DOM keeps a bounded number of messages.
Use it for
- An assistant or copilot panel that streams answers from a language model.
- Support or team conversations with people (typing indicator, attachments).
- Showing a transcript of a conversation, read-only (composer off).
Use something else for
- A single question and answer: use a form with Prompt Input or Textarea and show the result.
- Notifications or activity feeds: use a list or Toast.
- Comments attached to records with threading: build on a list; Chat is linear.
Anatomy
<div class="aui-chat"> <div class="aui-chat__viewport"> <div class="aui-chat__log" role="log" aria-live="off" aria-label="Conversation" tabindex="0"> <button class="aui-chat__earlier">Show earlier messages (240)</button> (over maxRenderedMessages) <p class="aui-chat__empty">No messages yet.</p> (no messages) <div class="aui-chat__messages"> <div class="aui-chat__day"><span>Today</span></div> <article class="aui-chat__message aui-chat__message--assistant" aria-labelledby="m1"> <div class="aui-chat__avatar">...</div> <div class="aui-chat__body"> <div class="aui-chat__meta" id="m1"><span class="aui-chat__author">Assistant</span> <time>10:42</time></div> <div class="aui-chat__content aui-chat__bubble aui-chat__content--markdown">...</div> <ul class="aui-chat__attachments"><li><button class="aui-chat__attachment">policy.pdf 80 kB</button></li></ul> <div class="aui-chat__error">Something went wrong...</div> (status error) <div class="aui-chat__actions" role="group" aria-label="Message actions">copy, thumbs up, thumbs down, Retry</div> </div> </article> </div> <div class="aui-chat__typing">... Grace is typing</div> (typing) </div> <button class="aui-chat__jump">Jump to latest</button> (scrolled up) </div> <div class="aui-chat__suggestions" role="group" aria-label="Suggestions">buttons</div> <div class="aui-chat__composer">Prompt Input</div></div>Live example
Section titled “Live example”Use the bar above each frame to switch theme, density, direction, and locale.
Chat in the Assistant showcase
Section titled “Chat in the Assistant showcase”The part of the Assistant showcase that uses Chat. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.
Showcase source
// Assistant showcase: an HR assistant answering from a simulated streaming server (word by word,// with realistic delays, abortable by Stop), suggestion chips, a reply that fails on purpose and// recovers with Retry, feedback and attachment events in the log, and a composer with attachments// and slash commands. Every answer is canned text; nothing leaves the page.import { instant, plainDate } from '@absoluteui/core';import { createBusinessCalendar } from '@absoluteui/components/business-calendar';import { Chat, type ChatRetryDetail, type ChatSendDetail } from '@absoluteui/components/chat';import type { PromptSuggestion } from '@absoluteui/components/prompt-input';import { action, annotate, choice, createShowcase, hostIn, toggle, wait } from './kit.js';
const sc = createShowcase({ title: 'Assistant', description: 'Ask the HR assistant a question or pick a suggestion: the answer streams in word by word. Press Stop to stop it, rate replies, attach files, or type / for commands.', simulated: true,});
const ANSWERS: readonly { readonly match: RegExp; readonly text: string }[] = [ { match: /leave|holiday|vacation|time off/i, text: 'You have **14 days** of annual leave left this year.\n\n- **Carry over:** up to 5 days into next year\n- **Next public holiday:** see the team calendar\n\nTo request leave, open *Time off* and choose **New request**.', }, { match: /payslip|salary|pay/i, text: 'Payslips are published on the **last working day** of each month.\n\n1. Open *My pay*\n2. Choose the month\n3. Download the PDF\n\nQuestions about deductions go to [the payroll team](https://example.com/payroll).', }, { match: /expense|receipt/i, text: 'Submit expenses within **30 days**. Attach the receipt and pick a category:\n\n```text\nTravel up to 250 EUR per night\nMeals up to 45 EUR per day\nEquipment needs manager approval\n```', },];const FALLBACK = 'I can help with **leave**, **payslips**, and **expenses**. Try asking "How much leave do I have?".';
let failNext = false;let wordDelay = 70;
/** The simulated streaming server: words with jittered delays; Stop aborts the wait. */async function* answer(question: string, signal: AbortSignal): AsyncGenerator<string> { await wait(450, signal).catch(() => undefined); const text = ANSWERS.find((a) => a.match.test(question))?.text ?? FALLBACK; const fail = failNext; failNext = false; const words = text.split(/(?<= )/); for (const [i, word] of words.entries()) { if (signal.aborted) return; if (fail && i === 6) throw new Error('503 Service Unavailable'); try { await wait(wordDelay * (0.5 + Math.random()), signal); } catch { return; } yield word; }}
const COMMANDS: readonly PromptSuggestion[] = [ { insert: '/leave', label: '/leave', description: 'Ask about your leave balance' }, { insert: '/payslip', label: '/payslip', description: 'Find your latest payslip' }, { insert: '/expenses', label: '/expenses', description: 'Expense rules and limits' },];
// Chat includes its prompt input.const host = annotate(hostIn(sc.stage), ['chat', 'prompt-input']);host.style.setProperty('block-size', '34rem');const now = Date.now();const chat = Chat.create(host, { label: 'Conversation with the HR assistant', authors: { assistant: { name: 'HR assistant' } }, businessCalendar: createBusinessCalendar({ holidays: [{ date: plainDate(2026, 12, 25), name: 'Christmas Day', yearly: true }, { date: plainDate(2026, 1, 1), name: 'New Year', yearly: true }] }), suggestions: [ { id: 'leave', label: 'How much leave do I have?' }, { id: 'payslip', label: 'Where is my payslip?' }, { id: 'expenses', label: 'What are the expense limits?' }, ], prompt: { placeholder: 'Ask the HR assistant', attachments: true, accept: ['.pdf', '.png', '.jpg', '.txt'], maxFileSize: 5 * 1024 * 1024, showHint: true, triggers: [{ char: '/', suggest: (query) => COMMANDS.filter((c) => c.label.slice(1).startsWith(query)) }], }, messages: [ { id: 'w1', role: 'system', text: 'Conversation started' }, { id: 'w2', role: 'assistant', text: 'Hello! I answer questions about **leave**, **payslips**, and **expenses**. What would you like to know?', timestamp: instant(now - 60_000) }, ],});sc.listen(host, ['aui-send', 'aui-stop', 'aui-retry', 'aui-feedback', 'aui-suggestion', 'aui-attachment-open'], 'chat');
host.addEventListener('aui-send', (e) => { const { text } = (e as CustomEvent<ChatSendDetail>).detail; void chat.stream((signal) => answer(text, signal), { errorMessage: 'The assistant is unavailable right now. Try again.' });});host.addEventListener('aui-retry', (e) => { const { id, prompt } = (e as CustomEvent<ChatRetryDetail>).detail; void chat.stream((signal) => answer(prompt?.text ?? '', signal), { id, errorMessage: 'The assistant is unavailable right now. Try again.' });});
action(sc, 'Fail the next reply', () => { failNext = true; sc.log('server', 'the next reply fails after a few words');}, ['chat']);action(sc, 'Colleague typing', () => { chat.update({ typing: chat.options.typing ? null : 'Grace Hopper' });}, ['chat']);choice( sc, 'Reply speed', [ { value: 'normal', label: 'Normal' }, { value: 'slow', label: 'Slow' }, { value: 'fast', label: 'Fast' }, ], 'normal', (speed) => { wordDelay = speed === 'slow' ? 220 : speed === 'fast' ? 20 : 70; }, ['chat'],);choice( sc, 'Reply format', [ { value: 'markdown', label: 'Markdown' }, { value: 'text', label: 'Plain text' }, ], 'markdown', (assistantFormat) => { chat.update({ assistantFormat }); }, ['chat'],);toggle(sc, 'Avatars', true, (showAvatars) => { chat.update({ showAvatars });}, ['chat']);toggle(sc, 'Timestamps', true, (showTimestamps) => { chat.update({ showTimestamps });}, ['chat']);toggle(sc, 'Send with Ctrl+Enter', false, (on) => { chat.update({ prompt: { ...chat.options.prompt, submitKey: on ? 'mod-enter' : 'enter' } });}, ['chat', 'prompt-input']);action(sc, 'Clear conversation', () => { chat.clear();}, ['chat']);Assistant with a streamed reply
Section titled “Assistant with a streamed reply”import { Chat, type ChatSendDetail } from '@absoluteui/components/chat';
const host = document.createElement('div');document.body.append(host);const chat = Chat.create(host, { label: 'Conversation with the assistant', suggestions: [{ id: 'leave', label: 'How many leave days do I have?' }] });
// Any async iterable of text chunks works: here a generator that waits between words.async function* reply(text: string, signal: AbortSignal): AsyncGenerator<string> { for (const word of text.split(' ')) { await new Promise((resolve) => setTimeout(resolve, 60)); if (signal.aborted) return; yield `${word} `; }}
host.addEventListener('aui-send', (event) => { const { text } = (event as CustomEvent<ChatSendDetail>).detail; void chat.stream((signal) => reply(`You asked: **${text}**. Here is what I found.`, signal));});Stream a server response (ReadableStream)
Section titled “Stream a server response (ReadableStream)”import { Chat, type ChatSendDetail, type ChatRetryDetail } from '@absoluteui/components/chat';
const host = document.createElement('div');document.body.append(host);const chat = Chat.create(host, { label: 'Assistant' });
function ask(question: string, id?: string): void { void chat.stream(async function* (signal) { // Stop aborts the request too. const response = await fetch('/api/answer', { method: 'POST', body: JSON.stringify({ question }), signal }); if (!response.ok || !response.body) throw new Error(String(response.status)); const reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); for (;;) { const { done, value } = await reader.read(); if (done) return; yield value; } }, id === undefined ? {} : { id });}
host.addEventListener('aui-send', (event) => { ask((event as CustomEvent<ChatSendDetail>).detail.text);});host.addEventListener('aui-retry', (event) => { const { id, prompt } = (event as CustomEvent<ChatRetryDetail>).detail; if (prompt) ask(prompt.text, id);});A conversation between people
Section titled “A conversation between people”import { instant } from '@absoluteui/core';import { Chat } from '@absoluteui/components/chat';
const host = document.createElement('div');document.body.append(host);const chat = Chat.create(host, { label: 'Chat with Grace Hopper', authors: { assistant: { name: 'Grace Hopper' } }, assistantFormat: 'text', feedback: false, messages: [ { id: '1', role: 'assistant', text: 'Did you get the onboarding checklist?', timestamp: instant(Date.UTC(2026, 10, 20, 9, 30)) }, { id: '2', role: 'user', text: 'Yes, thank you. One question about the laptop.', timestamp: instant(Date.UTC(2026, 10, 20, 9, 32)) }, ],});chat.update({ typing: 'Grace Hopper' });Day separators with holidays
Section titled “Day separators with holidays”import { instant, plainDate } from '@absoluteui/core';import { createBusinessCalendar } from '@absoluteui/components/business-calendar';import { Chat } from '@absoluteui/components/chat';
const calendar = createBusinessCalendar({ holidays: [{ date: plainDate(2026, 12, 25), name: 'Christmas Day', yearly: true }] });const host = document.createElement('div');document.body.append(host);Chat.create(host, { label: 'Support conversation', businessCalendar: calendar, timezone: 'Europe/London', messages: [{ id: '1', role: 'user', text: 'Is anyone working today?', timestamp: instant(Date.UTC(2026, 11, 25, 10)) }],});Plain text replies and no avatars everywhere
Section titled “Plain text replies and no avatars everywhere”import { configureAbsoluteUI } from '@absoluteui/core';
configureAbsoluteUI({ components: { chat: { assistantFormat: 'text', showAvatars: false } } });Install and start
Section titled “Install and start”npm install @absoluteui/components @absoluteui/core @absoluteui/themeRegistry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.
import { Chat } from '@absoluteui/components/chat';import '@absoluteui/components/button/style.css';import '@absoluteui/components/avatar/style.css';import '@absoluteui/components/prompt-input/style.css';import '@absoluteui/components/chat/style.css';First use
Section titled “First use”import { Chat } from '@absoluteui/components/chat';import '@absoluteui/components/button/style.css';import '@absoluteui/components/avatar/style.css';import '@absoluteui/components/prompt-input/style.css';import '@absoluteui/components/chat/style.css';
const host = document.querySelector<HTMLElement>('#transcript');if (host) Chat.create(host, { label: 'Transcript', composer: false, messages: [{ id: '1', role: 'user', text: 'Hello' }, { id: '2', role: 'assistant', text: 'Hi! How can I help?' }] });More usage
import { Chat, type ChatSendDetail } from '@absoluteui/components/chat';
const host = document.querySelector<HTMLElement>('#assistant');if (host) { const chat = Chat.create(host, { label: 'HR assistant', suggestions: [{ id: 'leave', label: 'How do I request leave?' }] }); host.addEventListener('aui-send', (event) => { const { text } = (event as CustomEvent<ChatSendDetail>).detail; void chat.stream(async function* () { yield `You asked: ${text}. `; yield 'Open **Leave** and choose *Request*.'; }); });}Using Angular? See Chat for Angular.
API reference
Section titled “API reference”Factory
Section titled “Factory”Chat.create(host: HTMLElement, options: ChatOptions): ChatGlobal configuration key: chat (see Configuration).
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
label |
string |
Accessible name of the conversation log. Required. | |
messages |
readonly ChatMessage[] |
"[]" |
Messages: { id, role, text, format?, timestamp?, author?, attachments?, status?, error?, feedback? }. |
authors |
Partial<Record<ChatRole, ChatAuthor>> |
Default author per role: { name, avatar?, icon? }. | |
suggestions |
readonly ChatSuggestion[] |
"[]" |
Suggestion chips above the composer: { id, label, text? } (hidden while streaming). |
typing |
string | null |
"null" |
Name of someone typing (people chats). |
composer |
boolean |
true |
Show the composer (Prompt Input). |
prompt |
Partial<Omit<PromptInputOptions, 'status' | 'value'>> |
Composer options (placeholder, attachments, accept, triggers, counter, submitKey, …). | |
emptyText |
string |
Text shown while there are no messages. | |
copyable |
boolean |
true |
Copy action on user and assistant messages (and on code blocks). |
feedback |
boolean |
true |
Thumbs up and down on finished assistant messages. |
businessCalendar |
BusinessCalendarEngine | null |
"null" |
Names holidays and non-working days in the day separators. |
today |
PlainDate |
Reference day for Today and Yesterday; default today in the timezone. | |
icons |
Partial<ChatIcons> |
Icon slot overrides. | |
assistantFormat |
'markdown' | 'text' |
"markdown" |
Format of assistant and tool messages that do not set format. Globally configurable. |
showTimestamps |
boolean |
true |
Show times and day separators. Globally configurable. |
showAvatars |
boolean |
true |
Show avatars next to messages. Globally configurable. |
maxRenderedMessages |
number |
200 |
Most messages in the DOM (integer 20..2000); earlier ones are behind Show earlier messages. Globally configurable. |
headingLevel |
number |
3 |
Heading level of a Markdown # heading (integer 2..6). Globally configurable. |
timezone |
string |
"UTC" |
IANA timezone of times and day separators. Globally configurable. Inherited from common configuration. |
locale |
string |
"en-US" |
Locale of labels, times, and dates. Globally configurable. Inherited from common configuration. |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
host |
HTMLElement |
The host element. |
messages |
readonly ChatMessage[] |
The messages in order (frozen copies). |
streaming |
boolean |
Whether a reply is streaming. |
following |
boolean |
Whether the log follows new content (the user has not scrolled up). |
prompt |
PromptInput | null |
The composer, or null when composer is false. |
options |
Readonly<ChatOptions> |
Current options. |
Methods
Section titled “Methods”| Method | Description |
|---|---|
addMessage(message: ChatMessage): void |
Append a message, or replace the message with the same id. |
updateMessage(id: string, patch: Partial<Omit<ChatMessage, 'id'>>): void |
Merge fields into a message. |
removeMessage(id: string): void |
Remove a message (stops it when it is streaming). |
clear(): void |
Remove every message. |
stream(source: ChatStreamSource | ((signal: AbortSignal) => ChatStreamSource), init?: ChatStreamInit): Promise<ChatMessage> |
Stream a reply into a new or existing message; resolves with the final message (complete, stopped, or error). |
stop(): void |
Stop the streaming reply; emits aui-stop. |
scrollToLatest(): void |
Scroll to the newest message and follow new content again. |
focus(): void |
Focus the composer (or the log without one). |
update(options: Partial<ChatOptions>): void |
Merge and apply options. |
destroy(): void |
Stop streaming and remove rendering, listeners, and subscriptions. |
Events
Section titled “Events”| Event | Detail | Bubbles | Cancelable | Description |
|---|---|---|---|---|
aui-send |
ChatSendDetail |
Yes | Yes | The user sent a message or chose a suggestion: { text, attachments }; prevent it to keep the text and add no message. |
aui-stop |
ChatStopDetail |
Yes | No | A streaming reply was stopped (Stop or stop()): { id }. |
aui-retry |
ChatRetryDetail |
Yes | No | Retry on a failed or stopped reply: { id, prompt } (the user message before it). |
aui-feedback |
ChatFeedbackDetail |
Yes | No | The user rated a reply: { id, value: ‘up’ | ‘down’ | null }. |
aui-suggestion |
ChatSuggestionDetail |
Yes | Yes | A suggestion chip was chosen: { suggestion }; prevent it to handle it yourself instead of sending its text. |
aui-attachment-open |
ChatAttachmentOpenDetail |
Yes | No | An attachment chip was activated: { messageId, attachment }. |
Content areas
Section titled “Content areas”| Area | Description |
|---|---|
messages[].text |
Message text: plain text or the Markdown subset (never HTML). |
CSS classes
Section titled “CSS classes”All rules live in the aui.components cascade layer, so application styles override them without specificity battles.
| Class | Purpose |
|---|---|
aui-chat |
Host (flex column). |
aui-chat--streaming | --no-avatars |
State modifiers on the host. |
aui-chat__viewport | __log |
Scroll container (role=log) and its positioned wrapper. |
aui-chat__earlier | __empty | __messages | __day |
Show earlier button, empty text, message list, day separator. |
aui-chat__message | __message--user | --assistant | --system | --tool | --error | --streaming |
A message (article) and its role and state. |
aui-chat__avatar | __avatar--icon | __body | __meta | __author | __time |
Avatar and the author and time line. |
aui-chat__bubble | __content | __content--markdown | __bubble--typing | __dots |
Message text and the typing dots. |
aui-chat__md-heading | __md-code | __md-link | __code | __code-head | __code-language | __code-copy | __code-body |
Markdown headings, inline code, links, and code blocks. |
aui-chat__attachments | __attachment | __attachment-name | __attachment-size |
Attachment chips. |
aui-chat__error | __stopped |
Error and stopped notices. |
aui-chat__actions | __action | __copy | __helpful | __unhelpful | __retry |
Message actions. |
aui-chat__typing | __jump | __suggestions | __suggestion | __composer |
Typing row, Jump to latest, suggestion chips, composer host. |
Icon slots
Section titled “Icon slots”| Slot | Default icon |
|---|---|
copy |
copy (icon set) |
helpful |
thumbs-up (icon set) |
unhelpful |
thumbs-down (icon set) |
retry |
refresh |
error |
alert-circle |
file |
file |
jump |
arrow-down |
assistant |
sparkles (icon set) |
tool |
code |
Design tokens
Section titled “Design tokens”Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.
--aui-border-width | --aui-color-border | --aui-color-border-strong | --aui-color-error-fg | --aui-color-focus-ring | --aui-color-hover | --aui-color-link | --aui-color-selected | --aui-color-selected-text | --aui-color-surface | --aui-color-surface-sunken | --aui-color-text | --aui-color-text-muted | --aui-duration-fast | --aui-easing-standard | --aui-focus-ring-offset | --aui-focus-ring-width | --aui-font-family-mono | --aui-font-family-sans | --aui-font-size-md | --aui-font-size-sm | --aui-font-weight-medium | --aui-font-weight-semibold | --aui-icon-size-md | --aui-icon-size-sm | --aui-line-height-normal | --aui-line-height-tight | --aui-radius-lg | --aui-radius-md | --aui-radius-pill | --aui-radius-sm | --aui-shadow-md | --aui-space-1 | --aui-space-2 | --aui-space-3 | --aui-space-4 | --aui-space-5
TypeScript definitions
type ChatRole = 'user' | 'assistant' | 'system' | 'tool';type ChatMessageStatus = 'complete' | 'streaming' | 'error' | 'stopped';interface ChatAuthor { name: string; avatar?: string | null; icon?: IconRef | null }interface ChatAttachment { id: string; name: string; size?: number; type?: string; file?: File }interface ChatMessage { id: string; role: ChatRole; text: string; format?: 'text' | 'markdown'; timestamp?: Instant; author?: ChatAuthor; attachments?: readonly ChatAttachment[]; status?: ChatMessageStatus; error?: string; feedback?: 'up' | 'down' | null;}interface ChatSuggestion { id: string; label: string; text?: string }type ChatStreamSource = AsyncIterable<string> | ReadableStream<string>;interface ChatStreamInit { id?: string; role?: 'assistant' | 'tool'; author?: ChatAuthor; format?: 'text' | 'markdown'; timestamp?: Instant; errorMessage?: string }interface ChatSendDetail { text: string; attachments: File[] }interface ChatRetryDetail { id: string; prompt: ChatMessage | null }interface ChatFeedbackDetail { id: string; value: 'up' | 'down' | null }Accessibility and performance
Section titled “Accessibility and performance”Accessibility
Section titled “Accessibility”Pattern: Log (WAI-ARIA role=log) of messages as articles, with a polite live region announcement per finished message; the composer is a labelled multi-line text field.
Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.
Keyboard
Section titled “Keyboard”| Key | Context | Action |
|---|---|---|
| Tab / Shift+Tab | Chat | Show earlier messages, the log (scrollable), links, code blocks, attachment chips, message actions, Jump to latest, suggestions, then the composer. |
| Arrow keys / Page Up / Page Down / Home / End | Log focused | Scroll the conversation (native). |
| Enter / Space | Buttons | Activate (copy, rate, retry, open attachment, suggestion, jump). |
| Enter | Composer | Send (Shift+Enter for a new line; configurable). |
| Element | Role |
|---|---|
| log | log (aria-live off; announcements go through the shared polite live region) |
| message | article, named by its author and time |
| actions | group (‘Message actions’) of native buttons; thumbs up and down are toggle buttons (aria-pressed) |
| attachments | list of buttons |
| suggestions | group of buttons |
| code block | figure with a caption (language) and a scrollable, focusable pre |
ARIA attributes
Section titled “ARIA attributes”| Attribute | Element | Value |
|---|---|---|
aria-label |
log | the label option |
aria-live |
log | off: streamed text is not read token by token |
aria-labelledby |
message | the author and time line |
aria-pressed |
feedback buttons | true for the chosen rating |
aria-label |
attachment chip | ‘Open <name>, <size>’ |
aria-controls |
Jump to latest | the log |
Focus stays where it is when messages arrive. Jump to latest moves focus to the newest message; Show earlier messages keeps focus on its button and keeps the reading position.
WCAG 2.2 success criteria addressed
Section titled “WCAG 2.2 success criteria addressed”Automated test results: Accessibility and compliance.
Notes and known caveats
Section titled “Notes and known caveats”- While a reply streams, assistive technology hears ‘<name> is typing’ once, then the finished reply (first 300 characters), or ‘Reply stopped’ or ‘Reply failed’.
- New messages from others (addMessage) are announced; the user’s own messages are not.
- The typing dots are decorative; the typing text is available to assistive technology.
- Auto-scroll stops while the user reads earlier messages, so content never moves under the reader (WCAG 2.2.2).
- Manual screen-reader verification (NVDA, JAWS, VoiceOver) is pending.
Performance
Section titled “Performance”| Import cost | Minified | gzip | brotli | CSS brotli |
|---|---|---|---|---|
@absoluteui/components/chat |
106.5 kB | 33.5 kB | 29.9 kB | 1.8 kB |
Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.
| Budget (enforced in CI) | Limit |
|---|---|
| Chat.create with 200 messages | < 60 ms in headless Chromium |
| Streaming repaint of a 5,000-character Markdown reply | < 8 ms per repaint (repaints are batched to at most one per 40 ms) |
Tested scale: 10,000 messages in the model with 200 in the DOM (maxRenderedMessages); replies up to 200,000 characters as Markdown, longer as plain text.
Only changed messages are rebuilt. Streamed text is stored at once and painted at most every 40 ms; Markdown is re-parsed per paint, linear in the reply length. The DOM keeps at most maxRenderedMessages messages.
Measured run times: Performance.
Details
Section titled “Details”States
Empty; messages; streaming (typing dots, then text); stopped; error with Retry; someone typing; following new content; reading earlier messages (Jump to latest shown); earlier messages collapsed; composer off.
State transitions
| From | Trigger | To |
|---|---|---|
| idle | composer send or suggestion | aui-send; a user message unless prevented |
| idle | stream(source) |
streaming: dots, then text; the composer shows Stop |
| streaming | source ends | complete; the reply is announced |
| streaming | Stop / stop() |
stopped; aui-stop; Retry shown |
| streaming | source throws | error; Retry shown |
| error or stopped | Retry | aui-retry (the host calls stream(source, { id })) |
| following | the user scrolls up | Jump to latest shown; no auto-scroll |
Accessibility notes
- While a reply streams, screen readers hear “<name> is typing” once, then the finished reply (first 300 characters), or “Reply stopped” or “Reply failed”; streamed chunks are never announced one by one.
- Auto-scroll stops while the user reads earlier messages, so content never moves under the reader.
- Code blocks scroll horizontally and are focusable.
- The e2e axe run covers three themes; manual screen-reader verification is pending.
Responsive behavior
The chat fills the height the host gives it; the log scrolls and the composer stays at the bottom. Bubbles take at most 48rem. Actions are always shown on touch screens.
Right-to-left
User messages sit on the left; code keeps left-to-right order; Jump to latest stays centered.
Theming
User and assistant bubbles use component tokens in the contrast gate; links in user bubbles inherit the bubble color and stay underlined. Forced colors outline bubbles; the typing dots stop animating for reduced motion and animation “none”.
Global configuration
configureAbsoluteUI({ components: { chat: { assistantFormat: 'text', showAvatars: false, maxRenderedMessages: 300 } } });Component configuration
Instance options override configuration; configuration changes re-render existing chats.
Timezones
Times and day separators use timezone (common config by default, UTC unless configured), never the machine’s zone. Messages carry Instant timestamps. With a business calendar, a separator on a holiday reads “25 Dec 2026 (Christmas Day)” and on a weekend “Saturday, Nov 21 (non-working day)”.
Icons
copy, helpful, unhelpful (icon set copy, thumbs-up, thumbs-down), retry (refresh), error (alert-circle), file (file), jump (arrow-down), assistant (icon set sparkles), tool (code). The composer’s icons are set through prompt.icons.
Security
Model output is untrusted. Plain text uses textContent; Markdown is parsed into a fixed set of elements whose text is set with textContent, and raw HTML in the source shows as text. Links render only for http(s) and scheme-less URLs (isSafeHref), open in a new tab with rel="noopener noreferrer nofollow", and unsafe links keep only their label. Avatar images follow the Avatar URL policy. Errors thrown by the stream are not shown; a generic or host-supplied message is.
Data handling
No persistence, network access, or telemetry. Streams are cancelled on Stop and destroy. Copy writes to the clipboard only when the user activates a copy button.
Supported data scale
10,000 messages in the model with 200 in the DOM; replies up to 200,000 characters as Markdown (longer text renders as plain text).
Edge cases
- Starting a stream while another streams stops the first.
- Removing a streaming message stops it; the stream’s promise still resolves.
- Non-string chunks are ignored.
- An unterminated code fence while streaming renders as a code block until it is closed.
- Messages without a timestamp get no time and no day separator.
Errors
| Code | Category | Cause |
|---|---|---|
CHAT_OPTIONS |
configuration | Blank label; invalid or duplicate messages (id, role, text, format, status, timestamp, author, attachments, feedback); invalid authors, suggestions, typing, businessCalendar, today, composer, copyable, feedback, or prompt; an invalid stream source or init. |
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION |
configuration | Invalid or unknown configuration. |
Invalid options throw before the host is modified; an invalid update() leaves the previous state intact. A failing stream never throws: the message gets status error.
Known limitations
- Not virtualized: the DOM keeps at most
maxRenderedMessagesmessages, and “Show earlier messages” adds earlier ones in steps. - The Markdown subset has no tables, images, task lists, or HTML; code is not highlighted.
- Announcements read the first 300 characters of a reply.
- Manual screen-reader verification is pending.
Unsupported scenarios
- HTML in messages.
- Threads and message editing (replace messages with
addMessageorupdate). - Opening attachments (the host handles
aui-attachment-open).
(c) 2026 Kasadara Technology Solutions Pvt Ltd. AbsoluteUI is free to use under the AbsoluteUI Free Use License; it is not open source.