# Waterfall Chart

Waterfall chart for how a total changes: the start total, the changes that move it and the end total, in one indigo scale with a +/− sign on every change.

- Category: Charts
- Page: https://wunderui.com/components/waterfall-chart
- Tier: Core and Pro

## Install

Waterfall Chart ships with WunderUI Core and Pro in the @wunderui/react package.

## Import

```tsx
import { WaterfallChart, WaterfallChartProps, WaterfallChartVariant } from "@wunderui/react"
```

## Minimal usage

Then use it:

```tsx
import { WaterfallChart } from "@wunderui/react/charts"

const data = [
  { step: "Q2 revenue", value: 248000 },
  { step: "New business", value: 64000 },
  { step: "Churn", value: -27000 },
  { step: "Q3 revenue", value: 0 },
]

export function RevenueBridge() {
  return <WaterfallChart data={data} index="step" label="Revenue bridge, Q2 to Q3" />
}
```

Expected result: A start bar, a rising step, a falling step and an end bar that matches the running total.

## When to use

### Use Waterfall Chart for

- How a start value becomes an end value: revenue to profit, last quarter to this one
- A bridge with a handful of increases and decreases
- A P&L as a horizontal bridge

### Use something else

- [Bar Chart](https://wunderui.com/components/bar-chart) for comparing periods or categories side by side
- [Stacked Chart](https://wunderui.com/components/stacked-chart) for the parts of a total
- [Funnel Chart](https://wunderui.com/components/funnel-chart) for a total that only shrinks from step to step
- [Range Bar Chart](https://wunderui.com/components/range-bar-chart) for a span per category

## Keyboard

The plot is focusable. Arrow keys step from bar to bar and the live region reads the change of the step you are on.

| Key | Action |
|---|---|
| `Tab` or `Shift+Tab` | Moves focus to the plot and away from it. The plot is one tab stop; so is every legend badge. |
| `ArrowRight` or `ArrowLeft` | Moves to the next or previous step. The tooltip follows, and a live region announces the one you are on. The first press starts at the first one (Left: the last one). |
| `Home` or `End` | Jumps to the first or last step. |
| `Escape` | Clears the active point. |
| `Enter` or `Space` | On a legend badge of a ChartCard: switches its series off or on. The last visible series stays on. |

## Behavior

What the chart does on its own and what the page decides.

- **Totals and steps:** The value field holds the start total, then the changes. An optional total field marks the total bars, otherwise the first and last rows are the totals.
- **Sign and colour:** Totals, increases and decreases use one indigo scale: totals strongest, increases medium, decreases light with an edge. A change's label carries a + or − sign, so colour is never the only cue.
- **Legend of roles:** The legend names roles (Total, Increase, Decrease), not series, so it is static. Pass the static legend option to the ChartCard.
- **Connectors:** The connectors variant draws a thin line from the end of one bar to the start of the next, which shows the running level.
- **Loading, empty and error:** The chart keeps its size while it loads, is empty or fails, so the card never jumps. Loading shows a muted shimmer, and an error shows a Try again button when you add a retry handler.
- **Legend:** A ChartCard shows the series as badges. With two or more series each badge switches its series off and the last visible one stays on, and a legend of roles instead of series can be made static.
- **Size:** The chart fills the width of its container, and you set the plot height. Text never scales, so labels keep their size at every width.

## Motion

The enter sequence and the hover follow the library's motion tokens.

- **Chain:** The bars enter one after another, each growing from where the previous one ended, and the whole chain takes as long as any chart's entrance. Decreases grow down, or to the left on the horizontal bridge, and the labels follow at the end.
- **Hover:** The hovered step keeps its strength and the others dim.
- **Reduced motion:** With reduced motion the enter sequence is off and the chart appears at once. The tooltip, crosshair and every state still work.

## Anatomy

- `WaterfallChart`: Takes data and an index. The value field holds the start total, then the changes, and an optional total field marks total bars, otherwise the first and last rows are totals.
- `Plot`: The focusable region. Arrow keys step from bar to bar and the live region reads the change of the step you are on.
- `Grid and axes`: A value axis that includes the running total. Horizontal waterfalls move the category names to the left.
- `Steps`: Totals, increases and decreases each have their own chart colour, and decreases get an edge. Each bar grows from where the previous one ended.
- `Value labels`: Signed labels (+12k, -4k) at the bars, shown for every bar when they fit and for the hovered bar otherwise. The sign makes colour a second cue, not the only one.
- `Connectors`: On the connectors variant, thin lines from the end of one bar to the start of the next show the running level across steps.
- `Tooltip`: For a step, the start level, the signed change and the end level. For a total bar, the total, and there is no change chip.
- `Loading, empty and error`: Muted columns (rows on the horizontal variant) under the shimmer. An error shows its title and a Try again button when you add a retry handler.
- `Data table and live region`: A table of the steps with their values for screen readers, plus the live region.

## Best practices

### When to use

- Use it to explain a change between two totals, such as revenue to profit or last quarter to this one. Use BarChart for plain period comparison.

### Do

- Start and end with total rows and keep the steps between them to ten or fewer. Group small movements into one Other step so each bar has room for its label.
- Put the biggest drivers first and sort increases and decreases in a stable order, so people compare the same bridge across periods.
- Format steps with an explicit sign in the value formatter (+$12k, -$4k). Colour separates increase from decrease, and the sign keeps that readable without it.

### Don't

- Don't mix units inside one waterfall. Every step must use the same currency or count, otherwise the running total means nothing.
- Don't use it for data that isn't a running sum. If the steps don't add up to the end total, a plain BarChart is the honest form.

## API reference

### WaterfallChart

| Prop | Type | Default | Description |
|---|---|---|---|
| data* | readonly ChartDatum[] |  | One object per category / point. |
| index* | string |  | Field holding the category label (x axis; y axis for horizontal bars). |
| activeIndex | number \| null |  | The active point (hovered or focused) as an index into `data`, to control it yourself. `null` shows none. |
| animate | boolean |  | Enter sequence (draw, wipe, grow) on scroll into view, after loading and on new data. Default true; off with reduced motion. |
| animationKey | string \| number |  | Change it to play the enter sequence again (e.g. `useChartReload().version`). New `data` replays it by itself. |
| aspectRatio | number |  | Width ÷ height when `height` is not set. Default 2.6. |
| axisFormatter | ChartValueFormatter |  | Value-axis labels; defaults to `valueFormatter`. |
| categoryAxis | boolean |  | Category-axis labels (default true). |
| categoryFormatter | (label: string) => string |  | Shortens category labels on the axis, e.g. "Mar 12" → "Mar"; tooltip and pill keep the full label. |
| categoryTicks | readonly string[] |  | Only these category labels are shown on the axis (the rest stay hoverable). |
| className | string |  | Extra classes for the root element of the chart. |
| defaultActiveIndex | number \| null |  | The point that is active at first, for an uncontrolled chart. It shows the tooltip without a pointer. |
| defaultSelectedRange | ChartRange \| null |  | The range that is selected at first, for an uncontrolled chart. |
| description | string |  | Screen-reader summary; generated from the data when omitted. |
| emptyDescription | string |  | Text under the title in the empty state. |
| emptyTitle | string |  | Title of the message in the empty state. |
| errorDescription | string |  | Text under the title in the error state. |
| errorTitle | string |  | Title of the message in the error state. |
| grid | boolean |  | Grid lines (default true). |
| gridFade | boolean |  | The grid fades out towards both ends (default true). |
| gridIntervals | number |  | Number of equal grid intervals. Default: one per 44 px of plot height, capped by the size class (xs 2, sm 3, md 3, lg 4, xl 5). |
| gridStyle | "solid" \| "dashed" |  | Grid lines are dashed 4 / 4 by default; `solid` draws them through. |
| height | number |  | Fixed height of the plot frame in px. Without it the height follows the width (`aspectRatio`, `minHeight`, `maxHeight`): 220 px on a phone, up to 434 px (the plot of the Figma large card) from about 1130 px wide. |
| hiddenSeries | readonly string[] |  | Series keys that are switched off (legend toggle): drawn faded, dimmed in the tooltip. |
| includeZero | boolean |  | The value axis starts at 0 (owner rule, default). `false` fits the data (prices, temperatures). |
| label | string |  | Accessible name, e.g. the card title. |
| maxHeight | number |  | Highest height from `aspectRatio`. Default 434. |
| minHeight | number |  | Lowest height from `aspectRatio`. Default 220. |
| onActiveIndexChange | (index: number \| null) => void |  | Called with the index when the pointer or the arrow keys move to another point, and with `null` when they leave. Use it to show the hovered value in a headline. |
| onRetry | () => void |  | Shows a Try again button in the error state and calls this when it is pressed. |
| onSelectedRangeChange | (range: ChartRange \| null) => void |  | Called when a drag across the plot or Shift with an arrow key changes the range, and with `null` when Escape or a click clears it. |
| rangeSelectable | boolean |  | Allow selecting a range by dragging or Shift + arrow keys. On when `onSelectedRangeChange` is set. |
| resolution | "auto" \| "full" |  | `auto` (default): lines and areas draw at most 1.5 points per pixel (LTTB; hover and tooltip keep every point), and bars on a time axis that would get thinner than they may are gathered into weeks, months … `full` draws every point and eve… |
| selectedRange | ChartRange \| null |  | The selected range as inclusive indices `[from, to]` into `data`, to control it yourself. `null` selects nothing. |
| state | "ready" \| "loading" \| "empty" \| "error" |  | `loading` shows the chart-shaped skeleton, `empty` and `error` a message in the plot. |
| tooltip | boolean |  | Tooltip on hover / keyboard focus. Default true. |
| tooltipTitle | (datum: ChartDatum, index: number) => React.ReactNode |  | Title line of the tooltip; defaults to the category label. |
| total | string |  | Field that marks a total bar (truthy). Default: the first and the last row are totals. |
| value | string | "value" | Field of the value: the start total, then changes (+/−). Default "value". |
| valueAxis | boolean |  | Value-axis labels (default true). Off for compact cards and sparkline-like plots. |
| valueAxisPlacement | "auto" \| "outside" \| "inside" |  | Where the value labels go: `outside` left of the plot, `inside` in the plot above their grid lines (saves the label column on narrow charts). `auto` (default) puts them left of the plot at every size; `inside` is opt-in. |
| valueAxisSide | "left" \| "right" |  | Side of the value axis (vertical charts). `right` is the price axis of trading charts. |
| valueDomain | readonly [number, number] |  | Fix the value domain instead of fitting it to the data (still rounded to nice steps). |
| valueFormatter | ChartValueFormatter |  | Values in tooltip, labels, table and live region. Default: 42000 → "42k". |
| valueTicks | readonly number[] |  | Exact value-axis ticks (ascending), e.g. [0, 10000, … 70000]; replaces the nice-step domain. |
| variant | "basic-waterfall" \| "waterfall-with-connectors" \| "horizontal-waterfall" | "basic-waterfall" | Figma variant. Default `basic-waterfall`. |
| width | number |  | Fixed width instead of filling and measuring the container. |
| xScale | "band" \| "time" |  | `band` (default): the categories sit side by side in equal bands. `time`: the `index` field holds dates (Date, ms or a string such as "2026-03-01"); points sit at their real distance, the axis picks its tick level (hours → days → weeks → m… |

## Examples

### States

## In context

### Revenue Bridge

Last quarter's revenue to this quarter's.

## For AI agents

`get_component("waterfall-chart")`

Hand your agent this page as Markdown or the WunderUI MCP server, not a screenshot.
