Waterfall
Things that start and last, as bars on one time axis: a page's requests, the steps of a job, a trace. Each span has a value, a label, a start and a duration in milliseconds, and may hold the spans it started as children: those open and close with the arrow keys or a press on the arrow. value and onValueChange hold the chosen span.
Preview
Use
import { Waterfall } from '@/components/ui';
<div className="ui-grow">
<Waterfall
aria-label="Loading the bookings page"
items={REQUESTS}
defaultExpanded={['data']}
nameHeader="Request"
marks={[{ time: 500, label: 'First content' }]}
format={{ style: 'unit', unit: 'millisecond', unitDisplay: 'narrow' }}
/>
</div>Options
| Option | Type | What it does |
|---|---|---|
aria-label Needed | string | Defines a string value that labels the current element. What it shows: "Network requests". |
className | string | More classes on the outer element, for layout around it (margins, grid placement), not to restyle it. |
columns | { header: ReactNode; cell: (span: WaterfallDataItem) => ReactNode; }[] · default [] | More columns between the name and the bars: a size, a status. |
marks | { time: number; label: ReactNode; }[] · default [] | Moments marked on the time axis, in milliseconds: "First paint". |
maxTicks | number · default 5 | The most ticks on the axis. |
nameHeader | ReactNode | The heading over the names. |
It also takes the 289 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.
Without React
The same look on any HTML, with the classes (React only).
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/icons.cssparts/waterfall.cssIn the examples
Small screens made with it and the rest of the kit. They work: click, type and choose in them.
Showing things: states, do and don’t
Things that start and last, as bars on one time axis: a page's requests, the steps of a job. items are { value, label, start, duration, children? } in milliseconds; spans with children open and close.
States. Lists, tables and boards have three more states besides their content: empty (Empty, with the first action inside), loading (Skeleton) and failed (Alert tone="danger"). A chosen row shows in ink, never in the brand colour.
Do
- Put numbers, dates and codes in
ui-mono(in a table cell,ui-num, which also aligns them). - Let a
Tableturn into blocks on a phone; give itscrollonly when it is read down its columns. - Show a status in words and colour together (
Badge tone="success"with "Paid"), never colour alone.
Don't
- Don't put a card round a
Table,List,Cells,CalendarorEmpty: they draw their own box. - Don't truncate a name or a price to fit; let it wrap. Truncate only file names and addresses.
- Don't use the status colours (success, warning, danger, info) for anything but those meanings.