---
id: portfolio.ds.chat-assistant-message
name: "Chat Assistant Message"
type: component
status: active
relations: [{"type":"composes","target":"portfolio.ds.reply-code-block"},{"type":"composes","target":"portfolio.ds.reply-divider"},{"type":"composes","target":"portfolio.ds.reply-heading"},{"type":"composes","target":"portfolio.ds.reply-list"},{"type":"composes","target":"portfolio.ds.reply-paragraph"},{"type":"composes","target":"portfolio.ds.reply-quote"},{"type":"composes","target":"portfolio.ds.reply-table"},{"type":"composes","target":"portfolio.ds.site-logo"},{"type":"composes","target":"portfolio.ds.icon-and-label-button"},{"type":"related_to","target":"portfolio.ds.homepage-hero"},{"type":"related_to","target":"portfolio.ds.chat-message-list"},{"type":"related_to","target":"portfolio.ds.chat-user-message"},{"type":"supersedes","target":"portfolio.ds.chat-assistant-message-old"},{"type":"uses_token","target":"portfolio.ds.primitive-scale"},{"type":"uses_token","target":"portfolio.ds.spacing"},{"type":"uses_token","target":"portfolio.ds.typography"},{"type":"uses_token","target":"portfolio.ds.max-widths"},{"type":"uses_token","target":"portfolio.ds.text-reveal-motion"}]
sources: ["packages/design-system/src/components/ChatAssistantMessage.astro","apps/portfolio-site/src/design-system/docs/chat-assistant-message.astro","apps/portfolio-site/src/lib/designSystemRegistry.ts","packages/design-system/src/components/chat-assistant-message.ts","packages/design-system/src/components/chat-markdown.ts","packages/design-system/src/components/parse-assistant-reply.ts","packages/design-system/src/components/render-assistant-reply.ts","packages/design-system/src/components/assistant-reply-templates.astro"]
catalog: ["apps/portfolio-site/src/design-system/docs/chat-assistant-message.astro"]
previews: ["apps/portfolio-site/src/design-system/docs/chat-assistant-message.astro"]
---
# Chat Assistant Message

## Purpose
Render plain or formatted assistant answers and request feedback inside Chat Message List without a bubble or visible author caption.

## Contract
- Props are `text`, optional authored `blocks`, accessible `label`, optional `id`, `state`, `loadingLabel`, `errorLabel`, `limitedLabel` and `retryLabel`. Role is fixed to assistant.
- States are `loading`, `loaded`, `default`, `error` and `limited`. The standard Preview exposes this exact set.
- The full-width host owns semantic left/right Block spacing and `--primitive-space-4` top/bottom padding, matching Chat User Message's internal vertical padding. Message List separately owns spacing between message components.
- Reply Paragraph owns the complete Body typography recipe and readable measure for answer paragraphs. The full-width host retains its Block spacing.
- Bold, italic, strikethrough, inline code and links belong to the paragraph's inline content, not to the list of top-level reply blocks. A rejected link preserves its label as plain text.
- `default` renders the complete answer. `loaded` visually reveals the complete validated answer while reserving its final layout. This is presentation of an already received answer, not network streaming.
- The standalone `text` prop and unconfigured adapters render escaped paragraphs. With host-configured `replyPresentation`, the first validated network text block is parsed as Markdown and mapped onto the same reviewed components. Subsequent source labels stay literal. No HTML, images, arbitrary attributes or model-defined styling are rendered. Only exact, host-approved paths can become links.
- Lists and table cells use plain text. Quotes without an attribution and unsupported block shapes stay readable as literal text. Very complex input falls back to plain paragraphs; the original answer is preserved in conversation history.
- When supplied, authored `blocks` replace `text`: paragraph blocks use Reply Paragraph, headings use Reply Heading at level 2 or 3, and ordered or unordered lists use Reply List with its nested items. Source order is preserved. The preview exercises this composition without changing the provider contract.
- Authored quotes use Reply Quote with a visible source label and optional source link. The parent separates a paragraph and an adjacent quote by two Body line heights in either order. Reply Quote owns its internal spacing. The reveal copy is inert; keyboard focus on the source link shows the canonical answer.
- The parent separates a paragraph and an adjacent ordered or unordered list by one Body line height in either order. This applies only to top-level reply blocks. Reply List owns its markers, indentation and item spacing.
- Authored table blocks use Reply Table. The parent leaves one Body line between a table and an adjacent paragraph in either order. Reply Table owns cell spacing and horizontal scrolling.
- Authored code blocks use Reply Code Block with the literal code string. The parent leaves one Body line between code and an adjacent paragraph in either order. The child owns indentation, colors, padding and horizontal scrolling.
- An authored `divider` renders Reply Divider. Leave one Body line between the separator and an adjacent non-heading block. Adjacent headings retain their own spacing, and there is no leading or trailing gap.
- Adjacent paragraphs are separated by one Body line height. Headings use their own line height: `2lh` before a heading and `1lh` after it. These rules apply during reveal and in the completed reply, with no outer spacing from the first or last block.
- `loading` shows localized waiting copy followed by the decorative inline Site Logo. Site Logo owns the blink and Reduced Motion behavior; Chat Assistant Message owns its `--primitive-space-4` size, `--primitive-space-2` gap and inherited secondary-text color. `error` shows localized failure copy and the canonical retry button. `limited` shows localized limit copy without retry.
- Chat owns requests, the successful-response loading minimum, history, cancellation, retry orchestration and scroll-follow. This child owns only presentation and emits the existing retry hook.

## Reveal
- The visual copy reuses the shared grapheme reveal helper with `textRevealMotion.assistant`. The complete semantic answer remains available once while the animated copy is aria-hidden.
- Loaded reveal becomes `default` after completion. Switching state, disconnecting or enabling Reduced Motion cancels or completes the reveal without restarting restored history.

## Use
- Use only as the private assistant-role child of Chat Message List. Product consumers must not use it directly.

## Do Not Use
- Do not render user messages, insert generated HTML, add provider logic or treat the reveal as response streaming.
- Do not move Chat-owned request lifecycle or history behavior into this component.

## Accessibility
- Preserve article semantics and the localized accessible author label.
- Waiting copy remains a status; the logo is decorative. Retry retains native button semantics.
- Reduced Motion skips the visual reveal and logo blink. The complete reading content remains available without per-character announcements or focus movement.

## Verification
- Check all five states, repeated and interrupted reveal, Reduced Motion and cleanup on disconnect.
- Check long and multiline plain text, escaped markup, full-width wrapping and overflow at every breakpoint.
- Check localized error/limited copy and the retry hook without making provider requests from the Preview.
- Confirm server-rendered and dynamically appended messages share the same markup and styling.

## Enabled Profile Records
- Registry ID: chat-assistant-message.
- Canonical route: /design-system/chat-assistant-message/.
