Sankey Chart
A React SVG sankey diagram that lays nodes out in columns from the links, draws gradient ribbons, highlights a node's flows on hover or focus and includes a hidden data table.
src/registry/ui/sankey-chart.tsx/r/sankey-chart.json
Installation#
bash
npx shadcn@latest add @minidev/sankey-chart
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/sankey-chart.json
Usage#
tsx
import { SankeyChart } from "@/components/ui/sankey-chart"
export function Example() {
return <SankeyChart />
}
API reference#
| Prop | Type | Default |
|---|---|---|
links | SankeyLink[] | SAMPLE_LINKS |
nodes | SankeyNodeInput[] | SAMPLE_NODES |
align | "left" | "justify" | "left" |
title | string | "Where signups come from" |
caption | string | "Last 30 days, visitors to paid plan" |
height | number | 320 |
nodeWidth | number | 10 |
nodePadding | number | 14 |
format | (value: number) => string | defaultFormat |
unit | string | "visitors" |
className | string | - |
Related charts components#
Area ChartDependency free SVG area chart for React with a smoothed line, dashed grid, gradient fill and an optional highlighted point. Strokes stay crisp at any size.Bar ChartLightweight React bar chart with rounded bars, dashed gridlines and labels. Hovering a bar dims the rest and shows its value; the peak is highlighted first.Chart CardCard wrapper for charts with a title, optional description and a minimum height body. Pairs with the area, bar and donut charts in a React dashboard.Chart LegendWrapping chart legend with small color swatches and labels. Pass colors per series or fall back to accent, success, warning and danger theme tokens.Chart Tooltip CardTooltip card for charts showing a title and label and value rows with tabular numbers. Drop it into any chart library's custom tooltip slot.Donut ChartSingle value donut chart in SVG that fills an accent ring to a percentage of max and prints the percent in the middle. Labelled as an image for screen readers.
All chart components