Page actions

Introduction

@threadplane/angular/chat is the Angular UI component library for building chat interfaces on top of one backend-neutral Agent. It is a set of composable, Signal-driven components that render messages, handle user input, display tool calls, manage interrupts, and support generative UI -- all styled with CSS custom properties and built for Angular 20–22.

Note: What this guide covers

This guide explains the library's two-tier architecture, how it relates to the rest of the Threadplane stack, and when to reach for the all-in-one composition versus assembling primitives yourself.

Build one conversation surface

Imagine a trip planner: the traveler enters a destination, watches an answer arrive, opens a weather result, and changes an itinerary. Start with the composition for the ordinary conversation. Reach for individual primitives when the itinerary, tool result, or approval needs a different place in the page.

The component tree does not own the agent's reasoning loop or persistence. It renders the current conversation and sends user actions to the agent. Follow a conversation explains that boundary from the first request to a saved thread.

How it fits

DiagramHow the Threadplane stack fits together
CHAT UI@threadplane/angular/chat<chat> · <chat-message-list> · <chat-input>Agent · signals over an AgentSessionSESSION@threadplane/langgraphSESSION@threadplane/ag-uiLangGraph PlatformCrewAI · Mastra · Agent Fwk · Strands · …
The chat components read only the injected Agent — the backend below is swappable.
Read diagram description

Read from top to bottom. The Angular chat composition and its message-list and input primitives read one Agent from @threadplane/angular: the snapshot fields of an AgentSession as signals, plus the session's commands. The session contract is defined in @threadplane/core, and two packages create a session that meets it. createSession() from @threadplane/langgraph connects to LangGraph Platform. createSession() from @threadplane/ag-ui connects to AG-UI backends such as CrewAI, Mastra, Microsoft Agent Framework and AWS Strands. Changing the session package does not require replacing the chat components.

Two-Tier Architecture

The library is organized into two layers: primitives and compositions.

Primitives

Primitives are low-level, headless components that read from an Agent and expose their state through content projection (ng-template). Template primitives let you provide the rendered content. Other primitives, including the input and tool-call controls, include their own interaction and styling. Compose the pieces when you need control over the surrounding layout or message presentation.

PrimitiveSelectorPurpose
ChatMessageListComponentchat-message-listIterates messages and renders via template directives
MessageTemplateDirectiveng-template[chatMessageTemplate]Declares a template for a specific message type
ChatInputComponentchat-inputText input with submit handling and keyboard shortcuts
ChatTypingIndicatorComponentchat-typing-indicatorAnimated dots shown while the agent is streaming
ChatErrorComponentchat-errorDisplays error messages from the agent
ChatInterruptComponentchat-interruptProjects interrupt content via a template
ChatToolCallsComponentchat-tool-callsIterates tool calls and projects each via a template
ChatSubagentsComponentchat-subagentsIterates the agent's child agents via a template
ChatThreadListComponentchat-thread-listRenders a list of conversation threads
ChatTimelineComponentchat-timelineIterates checkpoint history via a template

Compositions

Compositions are opinionated, styled components that combine primitives into ready-to-use UI blocks. They apply the --tplane-chat-* token system automatically and include markdown styling where needed.

CompositionSelectorPurpose
ChatComponentchatFull chat UI with messages, input, typing indicator, error, and thread sidebar
ChatInterruptPanelComponentchat-interrupt-panelStyled interrupt card with accept/edit/respond/ignore actions
ChatToolCallCardComponentchat-tool-call-cardExpandable card showing tool name, inputs, and output
ChatSubagentCardComponentchat-subagent-cardExpandable card showing subagent status and messages
ChatDebugComponentchat-debugDebug panel from @threadplane/angular/chat/debug with timeline, state inspector, and diff viewer
ChatTimelineSliderComponentchat-timeline-sliderSlider-based timeline navigation

How the Stack Fits Together

@threadplane/angular/chat sits between your application and the backend session below the Agent seam shown above; alongside it, @threadplane/angular/render turns specs in assistant messages into your components.

  • @threadplane/angular provides provideAgent() and injectAgent(). The injected Agent is a session's snapshot fields as Signals (messages(), status(), error(), toolCalls() and state(), plus the optional interrupts(), subagents(), plan() and checkpoints()) and the session's commands (submit, stop, and the optional resume, retry and regenerate). A field the backend does not report reads as undefined, and a command it does not offer is undefined.

  • @threadplane/langgraph and @threadplane/ag-ui each export createSession(), which runs a backend behind the framework-neutral AgentSession contract from @threadplane/core. You hand that factory to provideAgent({ createSession }). A backend can publish more than the core contract: a LangGraph session adds history(), fork() and branch data for checkpoint time-travel.

  • @threadplane/angular/render provides RenderSpecComponent and view registries for rendering JSON UI specs as Angular components. The ChatComponent auto-detects JSON specs in AI messages and renders them through @threadplane/angular/render - pass a view registry via the [views] input. A2UI rendering takes a separate [a2ui] input: pass a2uiRenderer() from @threadplane/angular/a2ui, whose default a2uiBasicCatalog() currently maps 18 component types.

When to Use ChatComponent vs. Custom Assembly

Use ChatComponent when you want a complete, styled chat interface with minimal setup. It includes message rendering (with markdown), a text input, typing indicator, error display, and an optional thread sidebar. Interrupt UI is not part of it — compose <chat-interrupt-panel> yourself when your runtime pauses for input. Drop it in, pass an Agent, and you have a working chat.

<chat [agent]="chatRef" />

Assemble primitives when you need to customize layout, add components between sections, change the message rendering logic, or integrate chat into a larger dashboard. Choose headless template primitives where you need custom markup, and styled primitives where their interaction matches your product.

<chat-message-list [agent]="chatRef">
  <ng-template chatMessageTemplate="human" let-message>
    <!-- your custom user message layout -->
  </ng-template>
  <ng-template chatMessageTemplate="ai" let-message>
    <!-- your custom assistant message layout -->
  </ng-template>
</chat-message-list>
 
<chat-input [agent]="chatRef" placeholder="Ask anything..." />

What's Next

Installation

Install the package, check the peer dependencies, and provide an agent.

Quick Start

Get a working chat UI running in under 5 minutes.

Theming

Customize colors, fonts, and spacing with CSS custom properties.

Lifecycle Signals

Subscribe to per-instance lifecycle signals via CHAT_LIFECYCLE.

Looking for something specific?