Nodes are placed in columns by their longest path from a source, so any acyclic flow — budgets, energy, conversion — lays out automatically.
Data for Oil, Gas, Grid, Homes, Industry, Loss
Source
Target
Value
Oil:
Grid.
25.
Gas:
Grid.
35.
Grid:
Homes.
30.
Grid:
Industry.
22.
Grid:
Loss.
8.
API Reference
Prop
Type
Default
Description
nodes
readonly SankeyNode[]
—
Graph nodes; colors follow order unless colorIndex is set
links
readonly SankeyLink[]
—
Directed weighted flows
width
number
—
Controlled layout width; enables deterministic SSR
initialWidth
number
—
SSR width hint replaced by client measurement
height
number
320
SVG height in px — width is measured from the container
nodeWidth
number
12
Node rectangle thickness in px
nodePadding
number
12
Vertical gap between nodes in a column, px
showLabels
boolean
true
Node labels beside each rect
showTooltip
boolean
true
Hover tooltip for nodes (throughput) and links (flow)
animate
boolean
true
Diagram fades in on mount
formatters
ChartFormatters
—
Format node labels and flow values across every surface
label
string
—
Accessible name; defaults to the joined node labels
labels
ChartLabels
—
Screen-reader text of the data table and the legend, for translation
showLabel
boolean
false
Render label as a visible title above the plot
sx
StyleXStyles
—
StyleX style override
SankeyNode
Field
Type
Description
id
string
Stable identity — links reference this
label
string
Node / tooltip label, falls back to id
colorIndex
number
Palette slot 0–7; defaults to input order
SankeyLink
Field
Type
Description
source
string
Source node id
target
string
Target node id
value
number
Finite positive flow magnitude; invalid links are skipped
Links referencing an unknown node, forming a self-loop, or carrying a non-positive value are dropped. The graph is assumed acyclic.
Accessibility
label provides the concise image name. description adds a richer summary through aria-describedby; consumer-owned text or a visible table can be linked with the aria-describedby prop.
Up to 20 valid links receive a visually hidden native source/target/value table. accessibleData replaces that table with custom React content; pass null to suppress it. labels translates the table text and the legend name.
Node, ribbon, and label marks remain aria-hidden; the chart is one image target and the table carries flow values.
The pointer tooltip is supplemental; the table carries values for assistive technology.
Server rendering
Pass width for deterministic server-rendered SVG. Use initialWidth for responsive hydration from a server estimate. Without either prop, the wrapper reserves height before client measurement.