Xzero UI
Pro library

Sankey flowPro

Flows between stages as ribbons with drifting particles; hover any node or ribbon to pour its share through the whole journey.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/sankey-flow
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-pro/sankey-flow

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 { SankeyFlow } from "@/components/xzero/sankey-flow/sankey-flow";

const nodes = [
  { id: "organic", label: "Organic" }, { id: "paid", label: "Paid" },
  { id: "activated", label: "Activated" }, { id: "inactive", label: "Not activated" },
  { id: "free", label: "Free" }, { id: "pro", label: "Pro" },
];
const links = [
  { source: "organic", target: "activated", value: 3380 }, { source: "organic", target: "inactive", value: 1820 },
  { source: "paid", target: "activated", value: 1990 }, { source: "paid", target: "inactive", value: 1910 },
  { source: "activated", target: "free", value: 3860 }, { source: "activated", target: "pro", value: 1510 },
];

export function SignupJourney() {
  return <SankeyFlow nodes={nodes} links={links} label="Signup journey" columns={["Source", "Activation", "Plan"]} unit="people" totalLabel="signups" />;
}

API reference

SankeyFlow

A Sankey diagram with smooth ribbons, values on every node, and fine particles drifting along each flow. Hovering a node or ribbon pours the share of every flow that passes through it, end to end. Sources wear the series palette derived from the accent, and a trace pours in its source's hue.

PropTypeDefaultDescription
nodes (required){ id: string; label: string; column?: number }[]–Nodes in the order they stack within each column. Columns default to each node's distance from a source.
links (required){ source: string; target: string; value: number }[]–Flows between node ids. A node's value is the larger of what flows in and out.
label (required)string–Names the chart for assistive technology.
columnsstring[]–Stage names printed above each column. Hidden when a name would not fit, and in the upright layout.
unitstring""Unit after values in the tooltip and table, such as "people".
totalLabelstring"the total"What the first column adds up to, used in shares such as "21% of signups".
formatValue(value: number) => string–Formats node values, the tooltip, and the table.
heightnumber340Plot height in pixels. The upright layout below 420px wide uses at least 480.
particlesboolean–Controlled particles along the ribbons.
defaultParticlesbooleantrueInitial particles state when uncontrolled.
onParticlesChange(on: boolean) => void–Called when the built in toggle is pressed.
particleTogglebooleantrueShows the Flow toggle under the plot.
emptyLabelstring"No flows yet"Shown when there are no positive links.
classNamestring–Extra class on the figure.

Keyboard interactions

KeysAction
TabFocuses the diagram and highlights the first node.
ArrowUp / ArrowDownMoves between nodes in a column (left and right in the upright layout).
ArrowLeft / ArrowRightSteps to the nearest node in the previous or next column (up and down in the upright layout).
Home / EndJumps to the first or last column.
EscapeClears the highlight.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in advanced charts

Guidance for AI tools

Sankey flow: Flows between stages as ribbons with drifting particles; hover any node or ribbon to pour its share through the whole journey. 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