Waterfall

Spans — a page's requests, a trace, a build — as bars on a shared time axis; a span that started others opens on them.

Data DisplayExperimental

Usage

Usage

Name
Size
DOMContentLoaded0 ms500 ms1,000 ms
index.html
14 kB
styles.css
32 kB
main.js
184 kB
inter.woff2
48 kB
/api/session
2 kB
hero.avif
96 kB
import { Component, ViewEncapsulation } from '@angular/core';import {  ScWaterfall,  ScWaterfallAxis,  ScWaterfallBar,  type ScWaterfallBarLabel,  ScWaterfallCell,  ScWaterfallColumnHeader,  ScWaterfallHeaderRow,  ScWaterfallIndicator,

Anatomy

You loop over the rows shown — rows(), the spans whose parents are open — a row each: its header (the indicator and the label), your cells, its bar. The header row, the axis and the marks are optional.

import { ScWaterfall, ScWaterfallAxis, ScWaterfallBar, ScWaterfallCell, ScWaterfallColumnHeader, ScWaterfallHeaderRow, ScWaterfallIndicator, ScWaterfallMark, ScWaterfallRow, ScWaterfallRowHeader } from '@semantic-components/ui';
<div scWaterfall #waterfall="scWaterfall" aria-label="Requests" [items]="spans">  <div scWaterfallHeaderRow>    <div scWaterfallColumnHeader class="w-48">Name</div>    <div scWaterfallColumnHeader aria-label="Timeline" class="flex-1">      <div scWaterfallAxis>        <span scWaterfallMark [time]="620">DOMContentLoaded</span>      </div>    </div>  </div>  @for (row of waterfall.rows(); track row.item.value) {    <div scWaterfallRow [row]="row">      <div scWaterfallRowHeader>        <button scWaterfallIndicator><svg siChevronRightIcon></svg></button>        {{ row.item.label }}      </div>      <div scWaterfallCell class="w-20">…</div>      <div scWaterfallBar></div>    </div>  }</div>

Spans and time

A span is { value, label, start, duration, children? }, in milliseconds on a shared clock. Its bar is a share of the range (by default, the first start to the last end) — --sc-waterfall-start, --sc-waterfall-size — from the start of the line; out of it, held to its edge. Times are written with format (milliseconds by default), in the app's language; a bar is read as its times ("120–460 ms"), or as barLabel says.

Keyboard

KeyDoes
↓ / ↑The next / previous row
→Opens the span, or goes to its first child
←Closes the span, or goes to its parent
Home / End, Page Up / Page DownThe first / last row; ten rows
Enter / SpaceSelects
LettersThe next row whose label starts with them

Accessibility

  • A tree grid (name it): rows with their level, their place among their siblings, open or not, selected or not; a row header names each span; one Tab stop.
  • A bar is a cell read as its times; the axis and the marks are hidden from screen readers. The indicator is for the pointer: the arrows open and close.

Examples

Nested spans

Span
0ms200ms400ms600ms800ms

None · 0 open

import { Component, ViewEncapsulation, signal } from '@angular/core';import {  ScButton,  ScWaterfall,  ScWaterfallAxis,  ScWaterfallBar,  ScWaterfallColumnHeader,  ScWaterfallHeaderRow,  ScWaterfallIndicator,  type ScWaterfallItem,

Zoom

Step
0 ms500 ms1,000 ms
Resolve route
Fetch data
Layout
Draw charts
Idle callbacks
import { Component, ViewEncapsulation, signal } from '@angular/core';import {  ScButton,  ScWaterfall,  ScWaterfallAxis,  ScWaterfallBar,  ScWaterfallColumnHeader,  ScWaterfallHeaderRow,  ScWaterfallIndicator,  type ScWaterfallItem,

Large trace

Job
0 ms5,000 ms10,000 ms
import { Component, ViewEncapsulation } from '@angular/core';import {  ScWaterfall,  ScWaterfallAxis,  ScWaterfallBar,  ScWaterfallColumnHeader,  ScWaterfallHeaderRow,  ScWaterfallIndicator,  type ScWaterfallItem,  ScWaterfallRow,

RTL

الاسم
0 ملي ث200 ملي ث400 ملي ث600 ملي ث800 ملي ث
الصورة
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import {  ScWaterfall,  ScWaterfallAxis,  ScWaterfallBar,  ScWaterfallColumnHeader,  ScWaterfallHeaderRow,  ScWaterfallIndicator,  type ScWaterfallItem,

API reference

Each part takes class, merged over its own (cn: a later class wins). The rows and cells are the style's table; the bar's corners its waterfall.

PartSelectorDescription
ScWaterfalldiv[scWaterfall] The tree grid: items, range, [(value)], [(expanded)], format, barLabel. exportAs scWaterfall: rows(), toggle(), expandAll(), collapseAll(), reveal(), focus().
ScWaterfallHeaderRow / ColumnHeaderdiv[scWaterfallHeaderRow], [scWaterfallColumnHeader] The column names; the timeline’s holds the axis.
ScWaterfallAxis[scWaterfallAxis] Round times (maxTicks) — or your ticks; holds the marks.
ScWaterfallTick[scWaterfallTick] A time on the axis: [time].
ScWaterfallMark[scWaterfallMark] A moment across the rows: [time], your text; data-outside.
ScWaterfallRowdiv[scWaterfallRow] A span: [row], one of rows(). data-level, data-branch, data-expanded, data-selected.
ScWaterfallRowHeader[scWaterfallRowHeader] Names the span, indented by its level.
ScWaterfallIndicatorbutton[scWaterfallIndicator] Opens and closes (the pointer’s): your chevron, turned when open.
ScWaterfallCell[scWaterfallCell] Another column: a status, a size.
ScWaterfallBar[scWaterfallBar] The span on the axis, read as its times.
InputTypeDefaultDescription
itemsScWaterfallItem[]— The spans: { value, label, start, duration, children? }.
range[number, number] | nullnull The time shown (ms); by default, all of it.
valuestring | nullnull The selected span: two-way.
expandedstring[][] The spans open: two-way.
formatIntl.NumberFormatOptions | (ms) => stringmilliseconds How times are written.
barLabel(item, { start, duration, range }) => stringits range A bar’s label for screen readers.