# ToolResult

Tool output, size-limited, with a safe fallback for content it can’t show.

- **Use it for**: Showing tool output safely, or through your own renderer.
- **Not for**: The whole call lifecycle. Try [ToolCall](https://unseenui.com/components/tool-call/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { ToolResult } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<ToolResult variant="code" text={output} error={error} onRetry={retry} />
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `className` | `string` |  |
| `error` | `string` |  |
| `label` | `string` | Names the bounded, keyboard-scrollable preview when several tools are visible. |
| `maxCharacters` | `number` |  |
| `onRetry` | `(() => void)` |  |
| `partial` | `ToolResultPartial` | Present while the tool is still returning output. |
| `result` | `ToolResultData` | A structured result; a registered renderer shows it, otherwise it is printed as bounded text. |
| `text` | `string` |  |
| `variant` | `"code" \| "text" \| "expandable"` |  |

## Keyboard

Tab reaches controls; Enter or Space activates buttons. Accordions use arrow keys, Home and End. Select menus support arrows and typeahead; Escape closes menus and dialogs and restores focus.

## Works with

[AgentSteps](https://unseenui.com/components/agent-steps/), [ToolCall](https://unseenui.com/components/tool-call/), [ToolGroup](https://unseenui.com/components/tool-group/), [ExecutionTimeline](https://unseenui.com/components/execution-timeline/), [RunInspector](https://unseenui.com/components/run-inspector/), [Plan](https://unseenui.com/components/plan/), [UsageMeter](https://unseenui.com/components/usage-meter/), [WorkSummary](https://unseenui.com/components/work-summary/), [ChainOfThought](https://unseenui.com/components/chain-of-thought/), [WorkflowGraph](https://unseenui.com/components/workflow-graph/), [ConnectionStatus](https://unseenui.com/components/connection-status/), [RunBoard](https://unseenui.com/components/run-board/)

Page: https://unseenui.com/components/tool-result/
