Chat
Host-driven chat surfaces — message row, smart-scroll list, responsive header and composer with optional source, command and model menus.
The chat pattern provides message rows, a smart-scrolling list, a controlled composer, and a responsive header. The host supplies messages, execution state, and localized copy. Optionally pass host-owned sourceItems, commandItems, and modelItems to ChatComposer; selection callbacks return stable host ids, and the component does not search, upload, execute a command, or call a model. Markdown message bodies can use @yuhuanowo/yunui/content. The chat API remains on its own subpath, @yuhuanowo/yunui/chat.
Existing message, composer and header props/slots remain available. Consumers can keep their current state and callback wiring; the updated appearance comes from YunUI's public components, so apps do not need to redraw these surfaces or copy their styles.
Install
The chat subpath ships with YunUI. If your chat renders Markdown or other rich content, install the optional content peers and styles described in the Content overview.
pnpm add @yuhuanowo/yunuiImport
import { ChatMessage, ChatMessageList, ChatComposer, ChatHeader,} from "@yuhuanowo/yunui/chat";Everything together
The workspace preview composes public ChatHeader, ChatMessageList, ChatMessage, ChatComposer, AgentRunStatus, AgentTimeline, ApprovalQuestion, and MarkdownRenderer exports. Its source/model lists and five agent states are local documentation fixtures; no message or tool request is sent.
Chat workspace
No host callback has run yet.
These controls use local documentation data. Questionnaire answers are separate from tool approval; only Allow or Deny decides the command, and no command is sent or run.
The pieces
Each block is exported standalone so you can assemble your own layout:
- Chat Message — a single row: avatar, header, body, footer and persistent actions.
- Chat Message List — the scroll container with smart stick-to-bottom.
- Chat Composer — the controlled input with Enter-to-send and optional host-fed source, command and model menus.
- Agent Timeline and Approval Question — host-fed activity rows and controlled user-question flow.
- Chat Header — the responsive header with slots.