Native Solid 2 fork of solid-recharts (MIT, © Thomas Guehenneux), derived from Recharts (MIT, © recharts). Adapted documentation; neither project endorses this fork.

Sankey

Sankey is a self-contained flow diagram that visualizes how quantities split, merge, and flow between stages. Nodes (rectangles) are connected by value-weighted ribbons, conveying the magnitude and direction of each flow. It is not placed inside another chart container.

Documentation flowVisits flow through docs and playground to installation.
() => {
const data = {
nodes: [{ name: "Visits" }, { name: "Docs" }, { name: "Playground" }, { name: "Install" }],
links: [
{ source: 0, target: 1, value: 60 },
{ source: 0, target: 2, value: 40 },
{ source: 1, target: 3, value: 35 },
{ source: 2, target: 3, value: 20 },
],
};
return <ResponsiveContainer width="100%" height={300} initialDimension={{ width: 560, height: 300 }}>
<Sankey data={data} nodePadding={24} title="Documentation flow" desc="Visits flow through docs and playground to installation." accessibilityLayer>
<Tooltip />
</Sankey>
</ResponsiveContainer>;
}

Props

PropTypeDefaultDescription
data{ nodes, links }—Nodes array + links array (source/target indices)
width, heightnumber | "%"—Fixed size or percentage inside ResponsiveContainer
margin{ top, right, ...}{ 5, 5, 5, 5 }Space around the plot area
nodeWidthnumber10Width of each node rectangle (in pixels)
nodePaddingnumber10Vertical space between nodes at the same depth
linkCurvaturenumber0.5Bezier curve tension (0 = straight, 1 = max curve)
align"left" | "justify""justify"Horizontal alignment of nodes
verticalAlign"top" | "justify""justify"Vertical alignment within columns
titlestring—Accessible title rendered in the root SVG
descstring—Accessible description rendered in the root SVG
accessibilityLayerbooleantrueDefaults the root SVG to role="application" and tabIndex={0}
roleSVG ARIA role"application" when accessibility layer is enabledExplicit role overrides the layer default
tabIndexnumber0 when accessibility layer is enabledExplicit numeric value overrides the layer default

The base API follows Recharts 3.9.2 (reference commit b3451050), with the selected next-suite title, desc, and accessibilityLayer additions. The supplied accessible name and description are present in server HTML and retained through hydration. These additions do not imply full Recharts 3.10.1 parity or screen-reader certification. See the release scope and Recharts Sankey reference.

Notes

  • Data shape: nodes is an array of { name, ... } objects. links is an array of { source, target, value } where source and target are node array indices.
  • Node names: The nameKey prop (default: "name") reads the node label from the node object.
  • Link width: Each ribbon's thickness is proportional to its value.
  • Tooltip: Sankey supports item-type tooltips on nodes and links. Hovering a node or link displays its details, including the flow value.
  • Custom renderers: Use the node and link props (function form) to render custom node/link graphics instead of the defaults.
  • Handlers: onMouseEnter, onMouseLeave, and onClick receive the item (NodeProps or LinkProps) and element type ("node" or "link").

See also