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.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
data | { nodes, links } | — | Nodes array + links array (source/target indices) |
width, height | number | "%" | — | Fixed size or percentage inside ResponsiveContainer |
margin | { top, right, ...} | { 5, 5, 5, 5 } | Space around the plot area |
nodeWidth | number | 10 | Width of each node rectangle (in pixels) |
nodePadding | number | 10 | Vertical space between nodes at the same depth |
linkCurvature | number | 0.5 | Bezier curve tension (0 = straight, 1 = max curve) |
align | "left" | "justify" | "justify" | Horizontal alignment of nodes |
verticalAlign | "top" | "justify" | "justify" | Vertical alignment within columns |
title | string | — | Accessible title rendered in the root SVG |
desc | string | — | Accessible description rendered in the root SVG |
accessibilityLayer | boolean | true | Defaults the root SVG to role="application" and tabIndex={0} |
role | SVG ARIA role | "application" when accessibility layer is enabled | Explicit role overrides the layer default |
tabIndex | number | 0 when accessibility layer is enabled | Explicit 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:
nodesis an array of{ name, ... }objects.linksis an array of{ source, target, value }wheresourceandtargetare node array indices. - Node names: The
nameKeyprop (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
nodeandlinkprops (function form) to render custom node/link graphics instead of the defaults. - Handlers:
onMouseEnter,onMouseLeave, andonClickreceive the item (NodePropsorLinkProps) and element type ("node"or"link").
See also
- ResponsiveContainer — fluid sizing
- Tooltip — hover info