Skip to content
Haze UI

Sankey flow

Connect staged quantities with proportional ribbons, switch between upright and wide layouts, and trace named node journeys.

pnpm dlx shadcn@latest add @haze/sankey-flow
Open preview in a new tab
Livesmall script

When to use

  • A total splits or combines between two or more ordered stages.
  • Incoming and outgoing quantities must be compared on a common ribbon-width scale.

When not to use

  • The journey is a single ordered conversion sequence. Use funnel-chart.

Installation

Add the Haze registry to components.json once, then install Sankey flow with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/sankey-flow
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
labelstringTrial journeyJourney caption.
nodes{ id: string; label: string; stage: number }[]–Unique node ids with finite ordered stages. Duplicate ids and invalid stages are omitted.
links{ source: string; target: string; value: number }[]–Positive finite forward links. Node height reserves the greater of inbound and outbound totals.
unitstringpeopleFlow unit for readout and the table.
classstring–Additional classes on the chart figure.

Keyboard interactions

Arrow keys
Select a node to trace its ancestors and descendants through the native select.

Accessibility

  • The trace selector names every node and reports incoming, outgoing and next destinations in text.
  • The table lists all valid flows and source shares. Only finite positive links between strictly increasing named stages are rendered.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Sankey flow" with `npx shadcn@latest add @haze/sankey-flow`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import SankeyFlow from "@/components/haze/ui/sankey-flow.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/sankey-flow.md

  • Customize with real content

    Adapt the Haze sankey-flow ui for our product. Replace the demo values of these props with our real content: label, nodes, links, unit, class. Keep the layout, the heading level rules and these accessibility details: The trace selector names every node and reports incoming, outgoing and next destinations in text. The table lists all valid flows and source shares. Only finite positive links between strictly increasing named stages are rendered. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using sankey-flow, check it fits: use it when a total splits or combines between two or more ordered stages.; incoming and outgoing quantities must be compared on a common ribbon-width scale.. Avoid it when the journey is a single ordered conversion sequence. use funnel-chart.. Alternatives: @haze/funnel-chart, @haze/streamgraph, @haze/sunburst.

Dependencies

  • npm: @lucide/astro
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog