Skip to content

Chat for Angular

AngularData display

A conversation view for an AI assistant or for people: user, assistant, system, and tool messages with avatars and timestamps (day separators name holidays and non-working days from a business calendar), assistant replies streamed from a host-supplied AsyncIterable<string> or ReadableStream<string> with Stop and Retry, a typing indicator, per-message errors, attachments as file chips, suggestion chips, copy and feedback 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, never as HTML from the model. 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.

Behavior, design tokens, and limitations are described on the Chat page; this page covers the Angular API.

import { Component } from '@angular/core';
import type { ChatMessage } from '@absoluteui/components/chat';
import { AuiChat } from '@absoluteui/angular/chat';
@Component({
selector: 'app-transcript',
imports: [AuiChat],
template: `<aui-chat label="Transcript" [messages]="messages" [composer]="false"></aui-chat>`,
})
export class TranscriptComponent {
readonly messages: ChatMessage[] = [
{ id: '1', role: 'user', text: 'Where is the travel policy?' },
{ id: '2', role: 'assistant', text: 'It is under **Policies > Travel**.' },
];
}
Terminal window
npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/theme

Setup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.

import { AuiChat } from '@absoluteui/angular/chat';

Defaults for every instance: provideAbsoluteUIConfig({ components: { chat: { ... } } }) (see Configuration).

Class AuiChat; template reference #ref="auiChat".

Server rendering: Renders on the server; the browser re-creates it after hydration.

Input Type Default Description
label string Required. Accessible name of the conversation log.
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, "value" | "status">> 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 ChatFormat 'markdown' Format of assistant and tool messages that do not set format.
showTimestamps boolean true Show times and day separators.
showAvatars boolean true Show avatars next to messages.
maxRenderedMessages number '200' Most messages in the DOM (integer 20..2000); earlier ones are behind Show earlier messages.
headingLevel number '3' Heading level of a Markdown # heading (integer 2..6).
timezone string 'UTC' IANA timezone of times and day separators.
locale string 'en-US' Locale of labels, times, and dates.
Output Payload Description
(sent) ChatSendDetail The user sent a message or chose a suggestion: { text, attachments }; prevent it to keep the text and add no message. Re-emits aui-send.
(stopped) ChatStopDetail A streaming reply was stopped (Stop or stop()): { id }. Re-emits aui-stop.
(retried) ChatRetryDetail Retry on a failed or stopped reply: { id, prompt } (the user message before it). Re-emits aui-retry.
(feedbackGiven) ChatFeedbackDetail The user rated a reply: { id, value: ‘up’ | ‘down’ | null }. Re-emits aui-feedback.
(suggestionChosen) ChatSuggestionDetail A suggestion chip was chosen: { suggestion }; prevent it to handle it yourself instead of sending its text. Re-emits aui-suggestion.
(attachmentOpened) ChatAttachmentOpenDetail An attachment chip was activated: { messageId, attachment }. Re-emits aui-attachment-open.

Call them through a viewChild query or a template reference.

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 | undefined): Promise<ChatMessage> | undefined 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).

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.

The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Chat: Accessibility and performance.