Skip to content
caliper ui docs

Pro

Tool result

The outcome of a tool call, collapsed to a summary and expandable to detail.

Pro
pnpm dlx shadcn@latest add @caliper/tool-result

Checks on fix/thread-status

Run by the assistant at 10:42 · 1 failure in thread.test.tsx

text
> caliper@0.4.0 test> vitest run
 ✓ src/counter.test.tsx (4 tests) 38ms ✓ src/table.test.tsx (12 tests) 91ms ✓ src/tree.test.tsx (9 tests) 64ms ✗ src/thread.test.tsx (6 tests | 1 failed) 120ms   → expected "Not sent" but received "Sending…"
 Test Files  1 failed | 3 passed (4)      Tests  1 failed | 30 passed (31)   Duration  1.02s

Installs components/ui/tool-result.tsxDepends on @radix-ui/react-slot, lucide-reactMotion shared motion tokens

When to use

Use it for

  • An agent calls tools and the user may want to inspect the output.
  • You want success and failure to read at a glance.

Skip it when

  • The output is the answer itself; show it as a message.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/tool-result

Adds its 7 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

Import it from your copy of the source. The example behind the preview comes with the source.

example.tsx
import { ToolResult } from "@/components/ui/tool-result"

The worked example comes with Pro

The 37-line example behind the preview opens here, ready to copy.

  • 626 Pro parts, blocks and page templates, all with source
  • $149 once, with lifetime updates. No renewal
  • A full refund within 14 days if it is not for you
Checking your licence…

API reference

ToolResult

component
PropTypeDefaultDescription
name *string—
summarystring—One line shown while collapsed, such as "12 files matched".
kindToolResultKind"text"
outputunknown—A string for text and error, any JSON value for json, rows for table.
columnsreadonly string[]—Column headings for table output; each row is an object or an array.
durationstring—
defaultOpenbooleanfalse
childrenReactNode—Replaces the body for kind "custom".
classNamestring—

Accessibility

It is built on native elements and keeps aria-label, aria-expanded, aria-controls and aria-hidden in step with state.

No custom key handling; Tab and the native activation keys do the work.

Motion

Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.

All Agent output examples