---
id: portfolio.ds.chat-composer
name: "Chat Composer"
type: component
status: active
relations: [{"type":"composes","target":"portfolio.ds.chat-text-input"},{"type":"composes","target":"portfolio.ds.chat-send-button"},{"type":"supersedes","target":"portfolio.ds.chat-composer-old"},{"type":"uses_token","target":"portfolio.ds.spacing"},{"type":"uses_token","target":"portfolio.ds.primitive-scale"},{"type":"uses_token","target":"portfolio.ds.border"},{"type":"uses_token","target":"portfolio.ds.shadow-soft"}]
sources: ["packages/design-system/src/components/ChatComposer.astro","apps/portfolio-site/src/design-system/docs/chat-composer.astro","apps/portfolio-site/src/lib/designSystemRegistry.ts"]
catalog: ["apps/portfolio-site/src/design-system/docs/chat-composer.astro"]
previews: ["apps/portfolio-site/src/design-system/docs/chat-composer.astro"]
---
# Chat Composer

## Purpose
The message form owned by Chat, composing its private text-input and send-button children.

## Contract
- Appears below the static separator in the Design System catalog as a clickable group containing Chat Send Button and Chat Text Input. Chat owns request state and transport; Composer owns the form, fieldset and child layout.
- Composes Chat Text Input in the first row and Chat Send Button in the second. The field takes the shared default prompt, `Have questions? Ask away.`.
- Always use Chat Send Button as the Composer's private Send/Stop child. With `pending=false`, the message can be written and sent; with `pending=true`, the send/response operation is in progress and clicking Stop halts it through the owning Chat controller. Do not duplicate this child or replace it with a separate action implementation.
- An optional `status` slot lets Chat place a no-script notice inside the fieldset surface when needed. The Homepage leaves it empty.
- Props label, placeholder, sendLabel, cancelLabel, pending, disabled and maxLength retain their behavior. The optional status slot and describedBy prop carry application-owned text and its input association. Preview exposes `Pending: false / true` separately from the canonical `State: normal / hover / focus / focus-visible / pressed / disabled` set. Focus/focus-visible/pressed focus the real textarea, normal and hover leave it unfocused, and disabled uses native fieldset semantics.
- Composer does not own a separate interaction-state appearance. Its Preview `State` is correlated one-to-one with the active Chat Text Input: `normal` to `normal`, `hover` to `hover`, `focus` to `focus`, `focus-visible` to `focus-visible`, `pressed` to `pressed`, and `disabled` to `disabled`. Chat Send Button interaction states are owned and reviewed in the separate Chat Send Button Preview; Composer's `Pending` switcher only chooses between its Send and Stop variants.
- Visual exception: Chat Text Input inside Composer intentionally deviates from the standard appearances for `hover`, `focus`, `focus-visible` and `pressed`. Those states keep the input visually neutral, without the standard state background, border or focus ring, so the field remains visually integrated into the Composer surface. The Preview still models the corresponding focus behavior; `disabled` continues to use the shared disabled treatment.
- Owns the neutral fieldset and horizontal Block padding outside it through --spacing-block-left/right. Top padding is 0 and bottom clearance uses `--primitive-space-4`: 12px on Mobile and 16px from Tablet upward. Mobile uses 16px horizontally; Tablet uses 32px; Desktop/Ultra-wide use 14.6% left / 23.6% right. Fieldset padding, fieldset gap and actions gap use `--primitive-space-3`: 8px on Mobile and 12px from Tablet upward.
- The fieldset border uses the approved `--border-default` token.
- In Chat, renders above the full-height list. Only the fieldset paints a background and `--shadow-soft` and receives pointer events; the surrounding dock/padding remains transparent and lets interactions reach the list underneath. Standalone Composer stays interactive without requiring its parent.
- Block spacing belongs to this component and applies relative to its containing width. Chat adds no outer padding. Pending makes the input read-only and shows Stop. Submission, cancellation and history belong to Chat.
- The text input itself grows to ten lines and scrolls beyond that; action buttons stay outside its scroll area.
- Parent previews use the same Composer defaults and must not override child-owned layout or copy.

## Use
- Use inside Chat or in its isolated Design System Preview.
- The Preview operates locally without making provider requests.

## Do Not Use
- Do not use outside Chat, move provider logic into Composer, or replace its private children with duplicate implementations.
- Do not override child-owned visuals or replace shared tokens with component-local values.

## Accessibility
- Preserve native form, fieldset, textarea and button semantics, accessible names, keyboard behavior and disabled/read-only states.
- Physical mobile keyboard and assistive-technology behavior still require separate review.

## Verification
- Check all four Preview contexts, available state controls, wrapping and geometry.
- Check composition with Chat Text Input and Chat Send Button, form submission hooks and pending cancellation hooks.
- Validate the canonical route, child imports and Essence graph without duplicate Preview initialization.

## Enabled Profile Records
- Registry ID: chat-composer.
- Canonical route: /design-system/chat-composer/. No legacy route or redirect is retained.
- Media: no new source or delivery assets.
