Xzero UI
Pro library

Streamgraph

Layered streams on a wiggle baseline that morph between ranges, with a layer you can isolate and read week by week.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/streamgraph
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/streamgraph

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Streamgraph } from "@/components/xzero/streamgraph/streamgraph";

const series = [{ key: "bugs", label: "Bugs" }, { key: "billing", label: "Billing" }, { key: "onboarding", label: "Onboarding" }];
const data = weeks.map(week => ({ key: week.iso, label: `Week of ${week.name}`, axisLabel: week.monthStart ? week.month : undefined, values: week.tickets }));

export function TicketsByTopic() {
  return <Streamgraph data={data} series={series} label="Support tickets by topic" unit="tickets" categoryLabel="Week" />;
}

API reference

Streamgraph

Layers stacked on a wiggle baseline that flow over time. Switching ranges morphs every layer; hovering one isolates it and reads every layer at that point.

PropTypeDefaultDescription
data (required){ key: string; label: string; axisLabel?: string; values: Record<string, number | undefined> }[]–Points in time. Datasets of any length morph into each other.
series (required){ key: string; label: string; color?: string }[]–Layers from the centre out: the first runs through the middle and the rest alternate above and below it.
label (required)string–Names the chart for assistive technology.
unitstring""Unit after each value.
heightnumber260Plot height in pixels.
offset"wiggle" | "silhouette" | "zero""wiggle"Wiggle minimises layer slopes, silhouette centres the stack, zero stacks from a flat baseline.
formatValue(value: number, series) => string–Formats values in the tooltip and table.
hiddenSeriesstring[]–Controlled hidden layers. A hidden layer thins to nothing and the rest reflow.
defaultHiddenSeriesstring[]–Initial hidden layers when uncontrolled.
onHiddenSeriesChange(hidden: string[]) => void–Called when a legend toggle is pressed.
onActiveChange(index: number | null, seriesKey: string | null) => void–Called as the reading moves between points and layers.
legendbooleantrueLayer toggles above the plot.
directLabelsbooleantrueNames each layer at its thickest stretch when the text fits.
categoryLabelstring"Date"Header of the first column in the screen reader table.
emptyLabelstring"No data for this range"Shown when there are no points.
classNamestring–Extra class on the figure.

Keyboard interactions

KeysAction
TabFocuses the plot and reads the latest point.
ArrowLeft / ArrowRightMoves through time.
ArrowUp / ArrowDownMoves the isolated layer up or down the stack.
PageUp / PageDown / Home / EndJumps by a sixth of the range, or to the first or last point.
EscapeClears the reading.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in charts

Guidance for AI tools

Streamgraph: Layered streams on a wiggle baseline that morph between ranges, with a layer you can isolate and read week by week. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components