Components
Waterfall
Tree of spans drawn as bars on a shared timeline, with expandable rows, markers and keyboard navigation.
import { Waterfall } from "@openperf/deft";
<Waterfall.Root aria-label="Spans" duration={120}>
<Waterfall.Ruler />
<Waterfall.Row duration={120} name="GET /checkout" start={0} tone="root" />
<Waterfall.Row depth={1} duration={30} label="30 ms" name="db.query" start={10} />
</Waterfall.Root>;When to use
| Need | Component |
|---|---|
| Items with a start and a duration inside one total | Waterfall |
| How a total splits into consecutive segments | Waterfall.Summary on its own |
| Values over time | Chart |
| Rows without a timeline | Table |
Anatomy
<Waterfall.Summary /> {/* standalone — needs no Waterfall.Root */}
<Waterfall.Root duration={120}>
<Waterfall.Ruler /> {/* tick labels above the timeline */}
<Waterfall.Row /> {/* rows are siblings; depth indents the name */}
<Waterfall.Row depth={1} />
<Waterfall.Details /> {/* inset panel under the row above */}
</Waterfall.Root>Rows are flat siblings: nesting is only the depth number. Waterfall keeps no expand or selection state, so render the rows that are visible and set expanded and selected from your own state.
Time scale
Every start, row duration and marker at is a number in the unit of the root duration, measured from the start of the timeline. A root duration below 1 is treated as 1, so pass durations in a unit where the total is at least 1, such as milliseconds.
The ruler labels its ticks as milliseconds unless formatDuration is passed. The name column is nameWidth pixels wide and never more than 60% of the component.
Expandable rows
Give expanded to every row that has children: the row then shows a toggle and calls onToggle. Filter out the descendants of collapsed rows yourself.
One row at a time is in the tab order. Arrow Up and Arrow Down move focus between visible rows, Arrow Right expands a collapsed row, Arrow Left collapses an expanded one, and Enter or Space selects. The toggle is not in the tab order.
Details
Select a row to open its details. Render Waterfall.Details right after the selected row and pass the same depth, so the panel lines up with the name.
Markers
kind | Shape |
|---|---|
log | Muted dot |
error | Diamond in the critical color |
at is measured from the start of the whole timeline, not from the start of the row.
Critical path
Set tone="path" on the rows that are on the path and dimmed on the rest. Dimmed rows keep their place and fade back.
Summary
One bar split into segments in proportion to their durations. errorAt is measured against the sum of the segment durations.
Flat density
| Density | Row height | Indent step | Rows without expanded |
|---|---|---|---|
tree | 28px | 14px | Reserve the space of a toggle |
flat | 26px | 16px | Reserve nothing |
API
Waterfall.Root
Set aria-label to name the tree.
Prop
Type
Waterfall.Ruler
The number of ticks follows the width of the timeline.
Prop
Type
Waterfall.Row
Takes only these props. A row scrolls into view when it becomes selected. Bars and markers carry no text, so put what matters in name and label.
Prop
Type
Waterfall.Details
Prop
Type
Waterfall.Summary
Prop
Type