Charts

Sankey

Flow diagrams showing the magnitude of flow between nodes

Sankey diagrams visualize flow quantities between a set of nodes, where the width of each link is proportional to its value. They are ideal for showing energy flows, user journeys, budget allocations, and similar many-to-many relationships.

Simple Sankey

A basic Sankey diagram with nodes and weighted links. The layout is computed by d3-sankey.

Custom Node

Use the #node slot to fully customize how each node is rendered. The slot receives coordinates, dimensions, and the node payload.

Sankey props

PropTypeDefaultDescription
data{ nodes, links }requiredGraph data with nodes and links arrays. Links use numeric source/target indices and a value.
widthnumberrequiredChart width in pixels
heightnumberrequiredChart height in pixels
nodeWidthnumber10Width of each node rectangle
nodePaddingnumber10Vertical padding between nodes in the same column
iterationsnumber32Number of d3-sankey layout iterations for relaxation
margin{ top, right, bottom, left }{ top: 5, right: 5, bottom: 5, left: 5 }Chart margins
nodeFillstring'#0088fe'Default fill color for node rectangles
nodeStrokestring'#fff'Stroke color for node rectangles
linkFillstring'#0088fe'Default fill color for link paths
linkStrokestring'none'Stroke color for link paths
isAnimationActivebooleantrueEnable entrance animation
transitionAnimationOptions{ duration: 0.8, ease: 'easeOut' }Animation timing (motion-v)

Slots

SlotPropsDescription
#node{ x, y, width, height, index, payload }Custom node rendering
#link{ d, sourceX, targetX, sourceY, targetY, linkWidth, index, payload }Custom link path rendering
defaultPlace <Tooltip> or other child components here.

Data structure

const data = {
  nodes: [
    { name: 'A' },
    { name: 'B' },
    { name: 'C' },
  ],
  links: [
    { source: 0, target: 1, value: 10 },
    { source: 1, target: 2, value: 6 },
  ],
}

source and target are numeric indices into the nodes array. value determines the link width. Both nodes and links support <Tooltip> hover interaction.

Copyright © 2026