# @salmonui/charts/sankey-chart API reference

> 12 exported symbols of @salmonui/charts/sankey-chart: 1 component, 1 function, 8 interfaces and 2 types.

Canonical: https://salmonui.dev/docs/reference/charts/sankey-chart

```ts
import { … } from '@salmonui/charts/sankey-chart';
```

## Components

### SankeyChart

Kind: component

Page: https://salmonui.dev/docs/reference/charts/sankey-chart/SankeyChart

```ts
function SankeyChart(props: SankeyChartProps): ReactNode;
```

Props: [`SankeyChartProps`](https://salmonui.dev/docs/reference/charts/sankey-chart/SankeyChartProps) (its members are the props)

## Interfaces

### SankeyChartProps

Kind: interface

Page: https://salmonui.dev/docs/reference/charts/sankey-chart/SankeyChartProps

```ts
interface SankeyChartProps {
    readonly nodes: readonly SankeyNode[];
    readonly links: readonly SankeyLink[];
    readonly orientation?: 'horizontal' | 'vertical' | undefined;
    readonly nodeWidth?: number | undefined;
    readonly nodePadding?: number | undefined;
    readonly linkColor?: 'source' | 'target' | 'gradient' | undefined;
    readonly curvature?: number | undefined;
    readonly labels?: boolean | {
        readonly position?: 'inside' | 'outside' | undefined;
    } | undefined;
    readonly legend?: boolean | {
        readonly position?: 'top' | 'bottom' | 'start' | 'end' | undefined;
        readonly title?: string | undefined;
    } | undefined;
    readonly tooltip?: boolean | {
        readonly renderNode?: ((node: SankeyNodeInfo) => ReactNode) | undefined;
        readonly renderLink?: ((link: SankeyLinkInfo) => ReactNode) | undefined;
    } | undefined;
    readonly highlight?: 'adjacent' | false | undefined;
    readonly onNodeClick?: ((node: SankeyNodeInfo, event: SankeyEvent) => void) | undefined;
    readonly onLinkClick?: ((link: SankeyLinkInfo, event: SankeyEvent) => void) | undefined;
    readonly onNodeHover?: ((node: SankeyNodeInfo | null) => void) | undefined;
    readonly onLinkHover?: ((link: SankeyLinkInfo | null) => void) | undefined;
    readonly getNodeStyle?: ((node: SankeyNodeInfo) => {
        readonly color?: string | undefined;
    } | undefined) | undefined;
    readonly getLinkStyle?: ((link: SankeyLinkInfo) => {
        readonly color?: string | undefined;
        readonly opacity?: number | undefined;
    } | undefined) | undefined;
    readonly formatLabel?: ((node: SankeyNodeInfo) => string) | undefined;
    readonly format?: Intl.NumberFormatOptions | ((value: number) => string) | undefined;
    readonly locale?: string | undefined;
    readonly text?: Partial<SankeyChartText> | undefined;
    readonly width?: number | undefined;
    readonly height?: number | undefined;
    readonly title?: string | undefined;
    readonly subtitle?: string | undefined;
    readonly description?: string | undefined;
    readonly showDataTable?: boolean | undefined;
    readonly className?: string | undefined;
    readonly style?: CSSProperties | undefined;
    readonly id?: string | undefined;
    readonly ref?: Ref<SankeyChartApi> | undefined;
    readonly onResize?: ((size: {
        readonly width: number;
        readonly height: number;
    }) => void) | undefined;
    readonly animated?: boolean | undefined;
}
```

Members (33):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `nodes` | `readonly nodes: readonly SankeyNode[];` |  |  |
| `links` | `readonly links: readonly SankeyLink[];` |  |  |
| `orientation` | `readonly orientation?: 'horizontal' \| 'vertical' \| undefined;` | optional |  |
| `nodeWidth` | `readonly nodeWidth?: number \| undefined;` | optional | Node thickness across the flow, px. Default 16. |
| `nodePadding` | `readonly nodePadding?: number \| undefined;` | optional | Gap between nodes in a column, px. Default 12. |
| `linkColor` | `readonly linkColor?: 'source' \| 'target' \| 'gradient' \| undefined;` | optional | Link color: the source or target node color, or a gradient between them. Default `source`. |
| `curvature` | `readonly curvature?: number \| undefined;` | optional | 0 (straight) .. 1. Default 0.5. |
| `labels` | `readonly labels?: boolean \| {     readonly position?: 'inside' \| 'outside' \| undefined; } \| undefined;` | optional |  |
| `legend` | `readonly legend?: boolean \| {     readonly position?: 'top' \| 'bottom' \| 'start' \| 'end' \| undefined;     readonly title?: string \| undefined; } \| undefined;` | optional |  |
| `tooltip` | `readonly tooltip?: boolean \| {     readonly renderNode?: ((node: SankeyNodeInfo) => ReactNode) \| undefined;     readonly renderLink?: ((link: SankeyLinkInfo) => ReactNode) \| undefined; } \| undefined;` | optional |  |
| `highlight` | `readonly highlight?: 'adjacent' \| false \| undefined;` | optional | Dim everything not connected to the hovered or focused node or link. Default `adjacent`. |
| `onNodeClick` | `readonly onNodeClick?: ((node: SankeyNodeInfo, event: SankeyEvent) => void) \| undefined;` | optional |  |
| `onLinkClick` | `readonly onLinkClick?: ((link: SankeyLinkInfo, event: SankeyEvent) => void) \| undefined;` | optional |  |
| `onNodeHover` | `readonly onNodeHover?: ((node: SankeyNodeInfo \| null) => void) \| undefined;` | optional |  |
| `onLinkHover` | `readonly onLinkHover?: ((link: SankeyLinkInfo \| null) => void) \| undefined;` | optional |  |
| `getNodeStyle` | `readonly getNodeStyle?: ((node: SankeyNodeInfo) => {     readonly color?: string \| undefined; } \| undefined) \| undefined;` | optional |  |
| `getLinkStyle` | `readonly getLinkStyle?: ((link: SankeyLinkInfo) => {     readonly color?: string \| undefined;     readonly opacity?: number \| undefined; } \| undefined) \| undefined;` | optional |  |
| `formatLabel` | `readonly formatLabel?: ((node: SankeyNodeInfo) => string) \| undefined;` | optional |  |
| `format` | `readonly format?: Intl.NumberFormatOptions \| ((value: number) => string) \| undefined;` | optional |  |
| `locale` | `readonly locale?: string \| undefined;` | optional |  |
| `text` | `readonly text?: Partial<SankeyChartText> \| undefined;` | optional | Built-in text (over the nearest `LocaleProvider`'s `sankeyChart` entry). |
| `width` | `readonly width?: number \| undefined;` | optional |  |
| `height` | `readonly height?: number \| undefined;` | optional |  |
| `title` | `readonly title?: string \| undefined;` | optional |  |
| `subtitle` | `readonly subtitle?: string \| undefined;` | optional |  |
| `description` | `readonly description?: string \| undefined;` | optional |  |
| `showDataTable` | `readonly showDataTable?: boolean \| undefined;` | optional |  |
| `className` | `readonly className?: string \| undefined;` | optional |  |
| `style` | `readonly style?: CSSProperties \| undefined;` | optional |  |
| `id` | `readonly id?: string \| undefined;` | optional |  |
| `ref` | `readonly ref?: Ref<SankeyChartApi> \| undefined;` | optional |  |
| `onResize` | `readonly onResize?: ((size: {     readonly width: number;     readonly height: number; }) => void) \| undefined;` | optional |  |
| `animated` | `readonly animated?: boolean \| undefined;` | optional | Entrance and update transitions, default `true`: client only (never in server markup), off under `prefers-reduced-motion`. The CSS is the opt-in `@salmonui/charts/viz-animations.css`. |

### SankeyChartText

Kind: interface

Page: https://salmonui.dev/docs/reference/charts/sankey-chart/SankeyChartText

```ts
interface SankeyChartText {
    readonly sankeyChart: string;
    readonly legend: string;
    readonly source: string;
    readonly target: string;
    readonly value: string;
}
```

Built-in text of a SankeyChart (`text` prop; the `sankeyChart` entry of a `LocaleProvider` catalog).

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `sankeyChart` | `readonly sankeyChart: string;` |  | Name and role description of the chart when there is no `title`. Default `"Sankey chart"`. |
| `legend` | `readonly legend: string;` |  |  |
| `source` | `readonly source: string;` |  | Data table headers. |
| `target` | `readonly target: string;` |  |  |
| `value` | `readonly value: string;` |  |  |

### SankeyEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/charts/sankey-chart/SankeyEvent

```ts
interface SankeyEvent {
    readonly source: 'pointer' | 'keyboard' | 'touch';
}
```

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `source` | `readonly source: 'pointer' \| 'keyboard' \| 'touch';` |  |  |

### SankeyLink

Kind: interface

Page: https://salmonui.dev/docs/reference/charts/sankey-chart/SankeyLink

```ts
interface SankeyLink {
    readonly source: string;
    readonly target: string;
    readonly value: number;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `source` | `readonly source: string;` |  |  |
| `target` | `readonly target: string;` |  |  |
| `value` | `readonly value: number;` |  |  |

### SankeyLinkInfo

Kind: interface

Page: https://salmonui.dev/docs/reference/charts/sankey-chart/SankeyLinkInfo

```ts
interface SankeyLinkInfo {
    readonly index: number;
    readonly source: SankeyNodeInfo;
    readonly target: SankeyNodeInfo;
    readonly value: number;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `index` | `readonly index: number;` |  | Index in `links`. |
| `source` | `readonly source: SankeyNodeInfo;` |  |  |
| `target` | `readonly target: SankeyNodeInfo;` |  |  |
| `value` | `readonly value: number;` |  |  |

### SankeyNode

Kind: interface

Page: https://salmonui.dev/docs/reference/charts/sankey-chart/SankeyNode

```ts
interface SankeyNode {
    readonly id: string;
    readonly label?: string | undefined;
    readonly offset?: number | undefined;
    readonly color?: string | undefined;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `id` | `readonly id: string;` |  |  |
| `label` | `readonly label?: string \| undefined;` | optional |  |
| `offset` | `readonly offset?: number \| undefined;` | optional | Pixel shift along the column after layout. |
| `color` | `readonly color?: string \| undefined;` | optional | Data color. |

### SankeyNodeInfo

Kind: interface

Page: https://salmonui.dev/docs/reference/charts/sankey-chart/SankeyNodeInfo

```ts
interface SankeyNodeInfo {
    readonly index: number;
    readonly id: string;
    readonly label: string;
    readonly value: number;
    readonly column: number;
    readonly color: string;
}
```

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `index` | `readonly index: number;` |  |  |
| `id` | `readonly id: string;` |  |  |
| `label` | `readonly label: string;` |  |  |
| `value` | `readonly value: number;` |  |  |
| `column` | `readonly column: number;` |  |  |
| `color` | `readonly color: string;` |  |  |

## Types

### SankeyChartApi

Kind: type

Page: https://salmonui.dev/docs/reference/charts/sankey-chart/SankeyChartApi

```ts
type SankeyChartApi = VizInstance;
```

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `element` | `element: HTMLElement \| null;` | inherited | The root `<figure>` (null before mount). |
| `export` | `export: (options?: VizExportOptions \| undefined) => Promise<void>;` | inherited | Downloads the visualization; settles after the download starts. |
| `toBlob` | `toBlob: (format?: ImageFormat \| undefined) => Promise<Blob>;` | inherited |  |
| `toDataURL` | `toDataURL: (format?: ImageFormat \| undefined) => Promise<string>;` | inherited |  |
| `toSVGString` | `toSVGString: () => string;` | inherited | The drawn SVG markup with `xmlns`, synchronously; theme colors stay `var(--salmon-*)` references. `toBlob('svg')` is the standalone file with colors resolved. Empty before mount. |
| `print` | `print: () => Promise<void>;` | inherited |  |
| `focus` | `focus: () => void;` | inherited | Focuses the plot (the one tab stop). |

## Re-exported entry points

- [@salmonui/charts/chart/export](https://salmonui.dev/docs/reference/charts/chart-export.md): 3 symbols: 1 function, 1 interface and 1 type
  `ExportVisualizationsOptions`, `ExportableVisualization`, `exportVisualizations`
