ToolCall
Compact, expandable step for tool and function invocations in chat and agent streams. Shows a status mark, a human summary, an optional identifier and duration, and expands to reveal `input`, `output` or custom details.
Preview
Usage
When to use
- Display individual tool or function invocations in an assistant stream with status, duration and expandable details.
- Let readers inspect raw arguments and outputs on demand without cluttering the conversation.
When not to use
- General chronological events such as an order history or activity feed. Use Timeline.
- Standalone syntax-highlighted code with a copy button. Use CodeBlock.
- General page FAQ sections or form disclosures. Use Accordion.
Variants
status
Invocation state: `running` shows a small Spinner, `success` shows a check, `error` shows a warning triangle.
Examples
Expanded tool call
Completed step opened by default to inspect its input query and output summary.
Running and failed steps
Active invocation without details stays static while a failed step expands to show the error output.
Static step
Without input, output or children, no chevron or disclosure button is rendered.
Do and don't
Do
- Write a plain human summary in title and keep the raw function name in tool.
- Omit input, output and children when there is nothing to inspect so the row stays static.
- Translate labels when the interface is not in English.
Don't
- Do not nest ToolCall inside a raised Card; its sunken surface sits cleanly on the page or in a message stream.
- Do not leave a step in running status after the stream stops.
Props
| Name | Type | Values | Default | Description |
|---|---|---|---|---|
| title required | node | - | - | Human-readable summary of the step, such as Search documentation. |
| tool | string | - | - | Optional technical or function identifier shown in monospace tertiary text, such as `search_docs`. |
| status | enum | running | success | error | success | Invocation state: `running` shows a small Spinner, `success` shows a check, `error` shows a warning triangle. |
| duration | string | - | - | Optional formatted elapsed time shown at the trailing edge, such as `420ms`. |
| input | node | - | - | Optional arguments or query payload shown inside the expanded panel. |
| output | node | - | - | Optional result or error message shown inside the expanded panel. |
| children | node | - | - | Optional custom detail body rendered inside the expanded panel. |
| open | boolean | - | - | Controlled open state. Pair with `onOpenChange`. |
| defaultOpen | boolean | - | false | Initial open state when uncontrolled. |
| onOpenChange | (open: boolean) => void | - | - | Called with the next open state when the user toggles the header. |
| labels | { input?: string; output?: string; running?: string; success?: string; error?: string } | - | - | Section and screen-reader status labels. Defaults: `Input`, `Output`, `Running`, `Completed`, `Failed`. |
Slots
| Name | Required | Description |
|---|---|---|
| title | yes | Human-readable summary of the tool invocation. |
| input | no | Optional arguments or query payload. |
| output | no | Optional result or error message. |
| children | no | Optional custom detail content. |
Anatomy
| Part | Description |
|---|---|
| root | The outer container: sunken fill, border and container corners, without drop shadows. |
| header | Summary row holding the status mark, title, optional tool name, duration and chevron. A button when expandable, static otherwise. |
| hitArea | Transparent ::before centered on the header button, at least `size-target-min` (24px on mouse, 44px on touch). |
| status | Status mark at the start: a small Spinner while running, a check in `color-text-success` on success, a warning triangle in `color-text-danger` on error. |
| title | Human-readable summary in medium primary text. |
| tool | Optional function identifier in monospace tertiary text. |
| duration | Optional elapsed time at the trailing edge in monospace tertiary text with tabular digits. |
| chevron | Turning 16px right chevron shown when the step can expand. |
| content | Collapsible panel below the header that opens with `duration-medium` and `ease-enter` and exits with `animate-exit-collapse`. |
| body | Inner wrapper carrying the top divider and `spacing-md` padding so the collapsing container shrinks cleanly to zero. |
| label | Section label (`Input`, `Output`) in small medium secondary text. |
| payload | Monospace block on page fill with inner corners for arguments or output; switches to danger tokens on error. |
Accessibility
Role: generic
| Keys | Action |
|---|---|
| Tab | Moves focus to the header button when `input`, `output` or `children` are present, then to any controls inside the expanded panel. |
| Enter, Space | On the header button, expands or collapses the detail panel. |
- When `input`, `output` or `children` is omitted, the header renders as static text without a button or chevron.
- Status icons are hidden from screen readers (`aria-hidden`) and paired with visually hidden status words (`Running`, `Completed`, `Failed`), customizable via `labels`.
Install
npx werewolf-ui add https://www.werewolf-ui.dev/r/tool-call.jsonRun npx werewolf-ui init once in your app before adding components. Init sets up tokens, their CSS import and agent rules. Add installs this component and its dependencies while preserving your theme. See Installation for requirements and the alternative registry setup.