# Waterfall

Supply UI 1.1.0. Showing things.

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

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.

## Options

| Option | Type | Default | 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; }[]` | `[]` | More columns between the name and the bars: a size, a status. |
| `marks` | `{ time: number; label: ReactNode; }[]` | `[]` | Moments marked on the time axis, in milliseconds: "First paint". |
| `maxTicks` | `number` | `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 renders (`className`, `aria-label`, events…).

## Without React

Classes: (React only)

## CSS parts

With the CSS in parts (`/ui/css/`), it needs: `components/icons.css`, `parts/waterfall.css`, besides the ones every page loads.

## In the examples

- Order to pass, timed: Each ticket on one time line; open a table for its dishes (https://www.supply.family/ui/#scene-kitchen)

## Showing things: notes

**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 `Table` turn into blocks on a phone; give it `scroll` only 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`, `Calendar` or `Empty`: 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.
