Ballmac UI home

Trace Waterfall

New

A trace as a waterfall: spans nested under the span that ran them, each a bar on a shared time axis with its duration, failed spans written out, collapsible branches and the full tree keyboard model.

v1.0.0Updated Oct 24, 2026Ships with a test
What changed
Step
Answer a billing question
Route the message
Billing agent
Plan the lookup
Search the policy
Look up the payment
Check refund eligibility
Decide what to say
Write the reply

Look up the paymentTool call

1.7 s → 2.94 s · 1.24 s · 16.8% of the run

GET /payments?customer=… returned 200 in 1.24 s.

Installation

$ pnpm dlx shadcn@latest add @ballmac/trace-waterfall

Usage

import { TraceWaterfall, flatten, formatMs } from "@/components/ballmac/trace-waterfall"

The full example is in the Code tab above.

Examples

A failed tool call

Step
Fix the failing export
Edit 4 files
Deploy to staging

Deploy to stagingTool callFailed

31.8 s → 40.9 s · 9.1 s · 22.2% of the run

The health check failed three times: GET /healthz returned 503.

API reference

PropTypeDefault
spans*TraceSpan[]—
total

Length of the whole run in milliseconds. Defaults to the end of the last span.

number—
selected

The selected span id. Controlled.

string | null—
defaultSelected

The selected span id for uncontrolled use.

string | nullnull
onSelectedChange

Called when a span is selected.

(id: string) => void—
defaultCollapsed

Spans that start collapsed.

string[][]

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
TabEnters the tree once, on the first span (or the selected one)
ArrowDown / ArrowUpNext or previous visible span; Home and End go to the first and last
ArrowRightOpens a closed span, or moves to its first child
ArrowLeftCloses an open span, or moves to its parent
Enter / SpaceSelects the span and shows its timing in a polite live region
Screen readersA tree: each item has its level, position and expanded state and reads 'Search repo, tool call, 420 ms, starts at 1.2 s, failed'

Use with AI

spans is [{ id, parentId?, name, kind?: model | tool | retrieval | agent | other, start: ms, duration: ms, status?: ok | error, tokens?, detail? }]. total (ms), selected / defaultSelected / onSelectedChange, defaultCollapsed (ids). Spans are nested by parentId; a span whose parent is missing is top level. Exports flatten and formatMs. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Trace Waterfall (@ballmac/trace-waterfall) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Seeing where an agent run spent its time, with nested model and tool calls
  • Debugging latency or a failed step in a trace

Not for

  • A plain list of steps; use trace
  • Who handed work to whom; use agent-lanes
  • Cost by step; use run-ledger

Registry JSON: https://ui.ballmac.com/r/trace-waterfall.json

Credits

Free to use in personal and commercial projects.

Ballmac UI Pro

Need the whole screen, not one piece?

150 premium blocks (dashboards, settings, calendars, mail, shops, onboarding), a private shadcn registry and Figma tokens. Blocks that show data come with loading, empty and error states built in.

Not ready? Try three Pro blocks free

Leave your email and the blocks appear right here, ready to copy. Yours to use in any project.