noahgdev

Sankey Chart

Dashboards

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"

// Sources carry a color; the activities on the right inherit it from their largest inflow.
const nodes = [
  { name: "Focus", color: "var(--color-violet-500)" },
  { name: "Meetings", color: "var(--color-sky-500)" },
  { name: "Breaks", color: "var(--color-lime-500)" },
  { name: "Admin", color: "var(--color-amber-500)" },
  { name: "Learning", color: "var(--color-pink-500)" },
  { name: "Browsing" },
  { name: "Writing" },
  { name: "Coding" },
  { name: "Calls" },
  { name: "Email" },
  { name: "Reading" },
  { name: "Planning" },
]

// Hours per week, sources on the left flowing into activities on the right.
const links = [
  { source: "Focus", target: "Coding", value: 8 },
  { source: "Focus", target: "Writing", value: 7 },
  { source: "Focus", target: "Browsing", value: 3 },
  { source: "Focus", target: "Planning", value: 2 },
  { source: "Meetings", target: "Calls", value: 7 },
  { source: "Meetings", target: "Planning", value: 2 },
  { source: "Meetings", target: "Email", value: 1 },
  { source: "Breaks", target: "Browsing", value: 5 },
  { source: "Breaks", target: "Reading", value: 1 },
  { source: "Admin", target: "Email", value: 5 },
  { source: "Admin", target: "Browsing", value: 2 },
  { source: "Admin", target: "Writing", value: 1 },
  { source: "Learning", target: "Reading", value: 4 },
  { source: "Learning", target: "Browsing", value: 1 },
  { source: "Learning", target: "Writing", value: 1 },
]

export default function SankeyChartDemo() {
  return (
    <div className="w-full max-w-lg">
      <SankeyChart nodes={nodes} links={links} valueFormatter={(value) => `${value}h`} />
    </div>
  )
}

Dependencies

More by noahgdev

View all
  • Donut Chart

    Donut Chart

    1
  • Metric List

    Metric List

  • Scatter Chart

    Scatter Chart

  • Radar Chart

    Radar Chart

  • Composed Chart

    Composed Chart

  • Bar Chart

    Bar Chart

  • Funnel Chart

    Funnel Chart

  • Activity Heatmap

    Activity Heatmap

More in Dashboards

View all
  • Fernly — Project Management Dashboard with Kanban

    Fernly — Project Management Dashboard with Kanban

    659
  • Analytics Dashboard

    Analytics Dashboard

    59
  • Creator Dashboard

    Creator Dashboard

    208
  • Insights Dashboard

    Insights Dashboard

    35
  • serf dashboard

    serf dashboard

    137
  • Corbel — Sales Analytics Dashboard

    Corbel — Sales Analytics Dashboard

    293
  • Dashboard with Collapsible Sidebar

    Dashboard with Collapsible Sidebar

    2.7K
  • Business/Sales Dashboard

    Business/Sales Dashboard

    1.5K