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 — totals strongest, increases medium, decreases light with an edge — and a +/− sign on every change.
Playground
Installation
Waterfall Chart comes with WunderUI Core and Pro, in the package from your plan. See the plans.
The charts live in their own entry point: import the chart, its card and its hooks from @wunderui/react/charts, not from @wunderui/react.
Then import what you need:
import {
WaterfallChart,
WaterfallChartProps,
WaterfallChartVariant,
} from "@wunderui/react/charts"Then use it:
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 for
- Bar Chart for comparing periods or categories side by side
- Stacked Chart for the parts of a total
- Funnel Chart for a total that only shrinks from step to step
- Range Bar Chart for a span per category
States
Loading, empty and error keep the chart's size, so the card never jumps. Add a retry handler and the error state offers a Try again button.
Keyboard interactions
The plot is focusable. Arrow keys step from bar to bar and the live region reads the change of the step you are on.
- TaborShiftTab
- Moves focus to the plot and away from it. The plot is one tab stop; so is every legend badge.
- ArrowRightorArrowLeft
- 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).
- HomeorEnd
- Jumps to the first or last step.
- Escape
- Clears the active point.
- EnterorSpace
- On a legend badge of a ChartCard: switches its series off or on. The last visible series stays on.
Behavior and motion
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.
- Grow
- Each bar grows from where the previous one ended the first time the chart is in view, and again after loading, on a key change or when new data arrives. You can turn it off.
- 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 shows how a start value becomes an end value through increases and decreases. Each bar floats from where the previous one ended, and totals stand on the zero line.
Revenue bridge
- Total
- Increase
- Decrease
| step | Change |
|---|---|
| Q2 revenue | $248k |
| New business | $64k |
| Expansion | $31k |
| Contraction | $-18k |
| Churn | $-27k |
| Q3 revenue | $0k |
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.
- data-slot="chart-plot"
The focusable region. Arrow keys step from bar to bar and the live region reads the change of the step you are on.
- data-slot="chart-grid"
A value axis that includes the running total. Horizontal waterfalls move the category names to the left.
- data-slot="chart-marks"
Totals, increases and decreases each have their own chart colour, and decreases get an edge. Each bar grows from where the previous one ended.
- data-slot="chart-values"
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.
On the connectors variant, thin lines from the end of one bar to the start of the next show the running level across steps.
- data-slot="chart-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.
- data-slot="chart-message"
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.
A table of the steps with their values for screen readers, plus the live region.
Best practices
- 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.
- Do
Put the biggest drivers first and sort increases and decreases in a stable order, so people compare the same bridge across periods.
- Do
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
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
One table for WaterfallChart. It is a plain component, so the table lists every prop, and the ChartCard around it takes its own props and works without one.
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.
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("waterfall-chart")The full library index for assistants is at /llms.txt.