Waterfall Chart for React
A React waterfall chart, or bridge chart, breaks a running total into its increases and decreases. Pass data as readonly WaterfallStep[]: the steps in order: { label, value }.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/waterfall-chart.jsonProfit and loss
WaterfallChartWaterfallTablewaterfallLegenddefaultWaterfallChartLabelsdefaultWaterfallTableLabels- +3 more
Annual results, step by step
Switch the year to see every bar morph to its new place. Below 480px, or as soon as a step name wouldn't fit whole under its column, it turns into horizontal bars. Hover, tap or use the arrow keys for each step's change and running total.
Profit and loss
Financial year 2026 results
- Increase
- Decrease
- Total
import { ChartCard } from "@/components/sheenui/charts/chart-parts/chart-card";
import { formatCompact } from "@/components/sheenui/charts/chart-utils";
import { waterfallLegend, WaterfallTable, WaterfallChart, type WaterfallStep } from "@/components/sheenui/charts/waterfall-chart";
// Package build (after the first npm release, or a packed tarball): import { ChartCard, formatCompact, waterfallLegend, WaterfallTable, WaterfallChart, type WaterfallStep } from "@sheenui/theme";
const usd = (n: number) => (n < 0 ? "−" : "") + "$" + formatCompact(Math.abs(n));
const steps: WaterfallStep[] = [
{ label: "Revenue", value: 4200000, kind: "start" },
{ label: "Cost of sales", value: -1640000 },
{ label: "Gross profit", kind: "subtotal" },
{ label: "Marketing", value: -620000 },
{ label: "R&D", value: -910000 },
{ label: "Net income", kind: "total" },
];
export function Example() {
return (
<ChartCard title="Profit and loss" legend={waterfallLegend()} table={<WaterfallTable data={steps} format={usd} />}>
<WaterfallChart data={steps} format={usd} aria-label="Profit and loss, FY26" />
</ChartCard>
);
}Files to copy
12 folders · 27 files · 4 packages
- From
theme/src/ components/charts/{waterfall-chart.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-tip.tsx, chart-utils.ts, heatmap.tsx}components/charts/chart-parts/components/charts/heatmap/components/drawer/parts/sheet.tsxcomponents/kbd/components/menu/components/skeleton/components/status-icons/hooks/{use-controllable.ts, use-intersection.ts, use-latest.ts, use-media-query.ts, use-preferences.ts}motion/tokens.tslib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, popup-a11y.ts, popup-motion.ts, warn-once.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/waterfall-chart.jsonRegistry item: waterfall-chart. The styles need the Tailwind v4 glass UI setup.- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".
Cash flow, horizontal
Horizontal at every width, for long step names. The running total dips below its start mid-month; the zero line firms up only when values cross it.
Cash flow
Net cash movement in October 2026 by step
- Inflow
- Outflow
- Balance
import { formatCompact } from "@/components/sheenui/charts/chart-utils";
import { WaterfallChart, type WaterfallStep } from "@/components/sheenui/charts/waterfall-chart";
// Package build (after the first npm release, or a packed tarball): import { WaterfallChart, formatCompact, type WaterfallStep } from "@sheenui/theme";
const usd = (n: number) => (n < 0 ? "−" : "") + "$" + formatCompact(Math.abs(n));
const cash: WaterfallStep[] = [
{ label: "Opening cash", value: 180000, kind: "start" },
{ label: "Customer receipts", value: 96000 },
{ label: "Payroll", value: -168000 },
{ label: "Suppliers", value: -74000 },
{ label: "Closing cash", kind: "total" },
];
export function Example() {
return (
<WaterfallChart
data={cash}
layout="horizontal"
format={usd}
labels={{ increase: "Inflow", decrease: "Outflow", total: "Balance" }}
aria-label="Cash flow in October"
/>
);
}WaterfallChart
WaterfallChartLabels keys and English defaults (7)
WaterfallTable props and waterfallLegend
WaterfallTableLabels keys and English defaults (1)
Keyboard
Accessibility
- Keyboard and screen-reader users get a single focusable figure labelled by the chart title, with a short reading hint as its description; inside a ChartCard with a table view, aria-details links it to the table. Every value read is announced politely, once. Every change carries a signed label (+ or −) and bars grow in their own direction, so color is never the only signal.
- WaterfallTable is the same data as a real table. Pass it to ChartCard's table prop and the Chart / Table tabs let anyone read every value without color or sight.
- With reduced motion on, the bars start at their final values and a data change jumps straight to the new state.
All exports on this page
WaterfallChart— A running total broken into its steps: a start, increases and decreases floating from the previous level, subtotals and a total from zero.WaterfallTable— Every step with its signed change and the running total after it.defaultWaterfallChartLabels— The built-in English strings of WaterfallChart; spread it into your own labels and change what you need.defaultWaterfallTableLabels— English defaults of WaterfallTableLabels.waterfallLegend— Legend items for a waterfall's three kinds of bar (pass to ChartCard's legend).
When to use the waterfall chart
- Use it as a profit and loss chart, from revenue through costs to net income, with increases and decreases floating from the previous level and a total drawn from zero.
- It fits a monthly cash flow with long step names, set to horizontal layout, where the running total dips below its start mid-month and the zero line firms up.
- It works for explaining a variance between two periods, such as budget to actual, with subtotals marking checkpoints along the way.
- Skip it when steps are not additive or have no meaningful order; use BarChart for plain comparison, and FunnelChart when each stage is a subset of the one before.
- Pair it with ChartCard, waterfallLegend for increase, decrease and total keys, and WaterfallTable to list each step's change and running total as text.
Frequently asked questions
Related pages
48 charts pages in all: browse them on Charts.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .