ChatTraceComponent
ChatTraceComponent is a primitive that renders a collapsible trace row for a single agent execution step. It shows a status indicator, label, optional metadata, and default slot content. Traces auto-expand while running and auto-collapse when done.
Selector: chat-trace
Import:
When to Use It
Use ChatTraceComponent when you want to expose agent reasoning steps, tool calls, or subgraph transitions to the user. It pairs well with the <chat-message-list> primitive to interleave execution traces with message bubbles.
For a fully managed tool call display, see <chat-tool-call-card>.
Basic Usage
API
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
state | 'pending' | 'running' | 'done' | 'error' | 'pending' | Current execution state. Controls the status icon and auto-expand behavior |
Outputs
None. State transitions are driven by the state input.
Slots
| Slot | Selector | Description |
|---|---|---|
| Default | (none) | Main trace content. Shown when the trace is expanded |
| Label | [traceLabel] | Custom label text in the trace header. Defaults to the state name |
| Icon | [traceIcon] | Custom icon in the trace header. Replaces the default state icon |
| Meta | [traceMeta] | Additional metadata shown in the header (e.g., duration, token count) |
Methods
| Method | Description |
|---|---|
toggle() | Manually toggles the expanded/collapsed state |
State Behavior
| State | Auto-expand | Status icon | Color |
|---|---|---|---|
pending | No | Clock | Muted |
running | Yes | Spinner | Warning |
done | Collapses | Checkmark | Success |
error | Yes | X mark | Error |
When state transitions from any value to 'running', the trace automatically expands. When state transitions to 'done', the trace automatically collapses. When state transitions to 'error', the trace automatically expands so the error content is visible.
Examples
Tool call in progress
Custom icon
Full component example
Styling
The component uses the following --ngaf-chat-* tokens:
| Token | Applied to |
|---|---|
--ngaf-chat-surface-alt | Trace row background |
--ngaf-chat-separator | Row border |
--ngaf-chat-radius-card | Row border radius |
--ngaf-chat-text | Label and content |
--ngaf-chat-text-muted | Meta text, icon |
--ngaf-chat-warning-text | Running state icon |
--ngaf-chat-success | Done state icon |
--ngaf-chat-error-text | Error state icon |
See Theming for the full token reference.