Skip to content
misoto22 design

Charts

SankeyChart

Where a quantity goes as it moves through stages.

When to reach for it

A funnel, a budget, an energy or traffic breakdown. The only chart here whose data is a graph rather than a table.

Examples

default

Visits by source and outcome
Visits by source and outcome
fromToValue
SearchSigned up42
SearchBrowsed68
SocialBrowsed51
SocialLeft34
DirectSigned up27
DirectLeft18

links and labels

Visits by source and outcome
Visits by source and outcome
fromToValue
SearchSigned up42
SearchBrowsed68
SocialBrowsed51
SocialLeft34
DirectSigned up27
DirectLeft18

loading

Visits by source and outcome
Loading

Notes

Where a quantity goes as it moves through stages — the shape for a funnel, a budget, an energy or traffic breakdown.

The only chart here whose data is a GRAPH rather than a table, so it takes { nodes, links } instead of rows, and the table view lists the flows rather than the nodes.

Props

SankeyChart props
PropTypeDefaultDescription
childrenrequiredReactNodeThe composed parts — axes, grid, tooltip, legend, and the marks themselves.
configrequiredChartConfigNode names → their label and paint.
datarequiredSankeyDataThe nodes and the links between them, in Recharts' own shape.
titlerequiredstringWhat the chart shows, in a sentence a reader could act on. Required, and announced to a screen reader even when it is not printed.
align'left' | 'justify''justify'How nodes are placed along the flow axis.
classNamestringMerged onto the figure, last, so a call site can size or space it.
defaultSelectedNodestring | nullnullThe node lit on first render. Selecting one dims every flow it does not touch.
descriptionReactNodeA line under the title — the unit, the window, the caveat.
hideDataTablebooleanfalseDrops the hidden table view. Only correct when the page prints the data itself.
isLoadingbooleanfalseSwaps the marks for an animated skeleton, keeping the measured height so the page does not jump when the data lands.
iterationsnumber32Layout passes. More is tidier and slower.
linkCurvaturenumber0.50 draws straight links, 1 the fullest curve.
nodePaddingnumber10Vertical gap between nodes in the same column, in pixels.
nodeWidthnumber10How wide each node rectangle is, in pixels.
onSelectionChange(selection: { name: string; value: number } | null) => voidFires when the selection changes, and with null when it is cleared.
sankeyPropsOmit<SankeyProps, 'data'>Escape hatch onto the raw Recharts Sankey element.
showTitlebooleanPrints the title above the plot instead of hiding it from sight.
sortbooleantrueLets the layout reorder nodes for the fewest crossings.
verticalAlign'justify' | 'top''justify'How nodes are distributed within a column.

Types

TSX
export type SankeyLinkVariant = 'gradient' | 'solid' | 'source' | 'target'
export type SankeyLabelPosition = 'inside' | 'outside'

Accessibility

  • title is required. The hidden table lists the FLOWS rather than the nodes — a table of node totals would lose every “from → to” the diagram exists to show.
  • Four link variants: gradient reads as flow, source and target attribute a band to one end, solid gives up colour and lets the nodes carry identity.