Trace Waterfall
Waterfall timeline showing nested trace spans as a collapsible hierarchy and timed duration bars.
- api-gateway
- inventory-svc
- postgres
- payment-svc
- mailer
- error
stripe.charge
payment-svc
- Duration
- 140 ms
- Share of trace
- 43.8%
- Starts at
- +115 ms
- Status
- error
- Span ID
- payment
- error.type
- card_declined
- stripe.request_id
- req_8Fq2LxN0
Keyboard
- ↑↓
- Move between spans
- →
- Expand, then enter children
- ←
- Collapse, then go to the parent
- HomeEnd
- First or last span
- EnterSpace
- Select or deselect the span
The CLI also installs the npm packages and registry items it builds on, and reads the style in your components.json to pick the Base UI or Radix build.
import { TraceWaterfall, type Span } from "@/components/ui/trace-waterfall"
const spans: Span[] = [
{ id: "1", name: "GET /orders", start: 0, duration: 240, service: "gateway" },
{ id: "2", parentId: "1", name: "SELECT orders", start: 18, duration: 90, status: "error", service: "postgres" },
]
export function RequestTrace() {
return <TraceWaterfall spans={spans} />
}TraceWaterfall
Waterfall timeline displaying distributed request spans as a collapsible tree and duration bars on a shared time axis.
| Prop | Type | Default |
|---|---|---|
spansRequiredSpan[]Array of trace spans with id, parentId?, name, start, duration, status?, service?, color?, attributes?: Record<string, string | number | boolean>. | Span[] | |
selectedSpanIdstring | nullControlled id of the selected span. | string | null | |
defaultSelectedSpanIdstring | nullDefaultnullInitially selected span id when uncontrolled. | string | null | null |
onSpanSelect(span: Span | null) => voidCalled when a span is selected or deselected. | (span: Span | null) => void | |
expandedSpanIdsstring[]Controlled ids of open branches. | string[] | |
defaultExpandedSpanIdsstring[]Defaultall parent spansInitially expanded branch ids when uncontrolled. | string[] | all parent spans |
onExpandedChange(expandedIds: string[]) => voidCalled when a branch opens or closes. | (expandedIds: string[]) => void | |
formatTime(ms: number) => stringDefaultformatDurationFormats millisecond values for ruler ticks, row durations and the details panel. | (ms: number) => string | formatDuration |
minBarWidthnumberDefault4Minimum pixel width for bars, ensuring zero-duration spans remain visible. | number | 4 |
showTimeAxisbooleanDefaulttrueRenders the top timeline ruler with time intervals. | boolean | true |
showGridLinesbooleanDefaulttrueRenders vertical alignment grid lines across rows matching ruler ticks. | boolean | true |
showSpanDetailsbooleanDefaulttrueShows a panel under the waterfall with the selected span's timing, status and attributes. Turn off when you render your own panel from onSpanSelect. | boolean | true |
Other props go to the <div>.
Request trace
Visualizes the call tree and execution timeline of an API request across database and service boundaries.
- web
- auth
- user-svc
- db
Selection and inspection
Control expanded branches and inspect the active span when clicked or activated via keyboard.
- ci-runner
- linter
- test-suite
- compiler
- deployer
Errors and zero-duration events
Highlights failed operations with destructive status styling and renders zero-duration checkpoint events with a visible marker.
- api-server
- auth
- postgres
- payment-gateway
- error