About
A flow diagram with tinted links, colored node bars, and share labels, on shadcn's chart primitives.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Sankey Chart to your project and fits it to your theme.
Code
How Sankey Chart is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client"
import { SankeyChart } from "@/components/ui/dashboardcn-sankey-chart"
import { formatNumber } from "@/components/ui/dashboardcn-sankey-chart"
const nodes = [
{ name: "Salary" },
{ name: "Freelance" },
{ name: "Dividends" },
{ name: "Housing" },
{ name: "Savings" },
{ name: "Leisure" },
{ name: "Groceries" },
{ name: "Insurance" },
{ name: "Transport" },
{ name: "Utilities" },
]
// Monthly cash flow, income on the left and budget categories on the right.
const links = [
{ source: "Salary", target: "Housing", value: 2400 },
{ source: "Salary", target: "Savings", value: 1200 },
{ source: "Salary", target: "Groceries", value: 900 },
{ source: "Salary", target: "Transport", value: 600 },
{ source: "Salary", target: "Utilities", value: 500 },
{ source: "Salary", target: "Insurance", value: 600 },
{ source: "Freelance", target: "Leisure", value: 1100 },
{ source: "Freelance", target: "Savings", value: 500 },
{ source: "Freelance", target: "Insurance", value: 200 },
{ source: "Dividends", target: "Savings", value: 200 },
{ source: "Dividends", target: "Leisure", value: 200 },
]
export default function SankeyChartCashflowDemo() {
return (
<div className="w-full max-w-lg">
<SankeyChart
nodes={nodes}
links={links}
valueFormatter={(value) =>
formatNumber(value, { format: "currency", maximumFractionDigits: 0 })
}
nodePadding={12}
/>
</div>
)
}
















