# C sankey 3

> Energy flow — source to use, with losses

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/c-sankey-3).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/c-sankey-3
- Screenshot: https://shadcn.exchange/shot/cnippet/c-sankey-3/light.png
- Registry item: https://ui.cnippet.dev/r/c-sankey-3.json
- Categories: sankey
- Listed: 2026-10-27, source last changed 2026-10-27

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/cnippet/c-sankey-3.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/sankey`, `@cnippet/chart-card`

## Files

### `registry/default/chart-variants/c-sankey-3.tsx`

```tsx
"use client";

import { ChartCard } from "@/registry/default/charts/chart-card";
import { Sankey } from "@/registry/default/charts/sankey";

const twh = (value: number) => `${value} TWh`;

const data = [
  { source: "Solar", target: "Grid", value: 62 },
  { source: "Wind", target: "Grid", value: 139 },
  { source: "Gas", target: "Grid", value: 76 },
  { source: "Gas", target: "Heat", value: 48 },
  { source: "Grid", target: "Homes", value: 128 },
  { source: "Grid", target: "Industry", value: 104 },
  { source: "Grid", target: "Losses", value: 45 },
  { source: "Heat", target: "Homes", value: 31 },
  { source: "Heat", target: "Industry", value: 17 },
];

export default function EnergyFlow() {
  return (
    <ChartCard
      className="max-w-2xl"
      description="Annual energy flow from source to use, simplified"
      footer="Losses are the share of generation that never reaches a consumer."
      title="Energy flow"
    >
      <Sankey
        className="h-48"
        data={data}
        nodePadding={16}
        nodeWidth={8}
        valueFormatter={twh}
      />
    </ChartCard>
  );
}
```
