Skip to main content
The Sankey component creates flow diagrams where the width of arrows is proportional to flow quantity. It’s ideal for visualizing energy transfers, material flows, cost distributions, or any process with inputs and outputs.

Basic sankey diagram

Sankey requires a specific data structure:
  • nodes: Array of objects with at least a name property
  • links: Array of objects with source, target (node indices), and value properties

Custom node width and padding

linkCurvature ranges from 0 to 1. Default is 0.5.

Custom node colors

Vertical alignment

  • "justify": Distributes nodes evenly and balances link paths
  • "top": Positions nodes starting from the top edge

Horizontal alignment

  • "justify": Start nodes align left, end nodes align right
  • "left": All nodes align to the left

Disable node sorting

By default, nodes are sorted vertically. Set sort={false} to preserve the order from your data.

Custom iterations

Event handlers

Event handlers receive three parameters:
  • item: The node or link data
  • type: Either 'node' or 'link'
  • event: The mouse event

With margin

Complex flow example

Common pitfalls

  • Data structure: Links must reference nodes by their array index (0-based), not by name or id.
  • Node order: The order of nodes in the array affects visualization. Place source nodes before target nodes for best results.
  • Responsive sizing: Sankey doesn’t support responsive mode. Always use fixed width and height.
  • Missing values: Every link must have a value property. Missing or zero values may cause rendering issues.
  • Tooltip event type: Sankey only supports 'item' tooltip event type.
  • Cyclic flows: Sankey diagrams are designed for acyclic flows (no loops). Cycles in data may produce unexpected results.