Sankey Chart

Weighted flows between stages that draw in and morph with your data.

Preview

Income statement, Q3 data
FlowValueShare of source
Subscriptions to Revenue$70M100.0%
Services to Revenue$17M100.0%
Marketplace to Revenue$14M100.0%
Revenue to Cost of revenue$36M35.6%
Revenue to Gross profit$65M64.4%
Gross profit to R&D$22M33.8%
Gross profit to Sales & marketing$17M26.2%
Gross profit to G&A$7M10.8%
Gross profit to Operating profit$19M29.2%

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/sankey-chart

API Reference

SankeyChart

nodes
readonly SankeyNode[]
—
links
readonly SankeyLink[]

Weighted flows between node ids. Links that would close a loop are left out.

—
label?
string
—
formatValue?
((value: number) => string)
—
colors?
readonly string[]

Palette for nodes without their own color, in node order.

—
nodeWidth?
number

Node bar width in px.

—
nodePadding?
number

Space between nodes in a column, in px.

—
activeId?
string | null

Highlighted node or link id. Controlled. Link ids default to `source:target`.

—
defaultActiveId?
string | null
—
onActiveChange?
((id: string | null) => void)
—
className?
string
—

SankeyChartPlot

className?
string

Sets the plot height; default 20rem. The layout follows its measured size.

—
showValues?
boolean

Show each node's value under its label when there is room.

true

SankeyChartTooltip

className?
string
—
side?
"bottom" | "left" | "right" | "top"
top
children?
ReactNode | ((active: SankeyActive) => ReactNode)

Custom content for the highlighted node or flow.

—

Updated