Documentation / Charts
WaterfallChart
How one figure becomes another: each contribution, positive or negative, floats between the running total before it and the one after it. It is the chart of budget variances, of revenue down to profit, of subscriber movements. A BarChart of the same items would show their sizes without saying how they add up.
- Colour comes from the diverging pair: a step is a move above or below the running total. It states the direction, never the verdict.
- The connectors are not decoration: without them, a floating bar loses its tie to the previous one. They are on by default.
- A row marked by the
totalfield is a checkpoint drawn from zero; if it also carries a value that contradicts the sum, the gap is shown rather than hidden.
There is no sort: the order of the rows is the chart. Client component ("use client").
Examples
Budget variance
value reads each item’s contribution, total marks the checkpoints: the first opens the running total, the last closes it.
import { WaterfallChart } from "@synertech/ui";
const budget = [
{ item: "Budget voté", amount: 1_240_000, checkpoint: true },
{ item: "Salaires", amount: -486_000 },
{ item: "Infogérance", amount: -212_000 },
{ item: "Licences", amount: -98_000 },
{ item: "Refacturation", amount: 64_000 },
{ item: "Subvention", amount: 130_000 },
{ item: "Réalisé", checkpoint: true },
];
const euros = new Intl.NumberFormat("fr-FR", {
style: "currency",
currency: "EUR",
notation: "compact",
});
export function Basic() {
return (
<WaterfallChart
data={budget}
x={{ key: "item" }}
value="amount"
total="checkpoint"
y={{ label: "Euros" }}
format={(value) => euros.format(value)}
title="Du budget voté au réalisé"
height={320}
/>
);
}Horizontal, with a subtotal
Once step names get long, orientation="horizontal" is the way to go. An intermediate checkpoint (“Marge brute”, gross margin) with no value shows the total reached.
import { WaterfallChart } from "@synertech/ui";
const profit = [
{ step: "Chiffre d’affaires", amount: 482_000, checkpoint: true },
{ step: "Coût des ventes", amount: -196_000 },
{ step: "Marge brute", checkpoint: true },
{ step: "Ventes et marketing", amount: -84_000 },
{ step: "Recherche et développement", amount: -112_000 },
{ step: "Administration", amount: -41_000 },
{ step: "Résultat d’exploitation", checkpoint: true },
];
const euros = new Intl.NumberFormat("fr-FR", {
style: "currency",
currency: "EUR",
notation: "compact",
});
export function HorizontalWithSubtotal() {
return (
<WaterfallChart
data={profit}
x={{ key: "step" }}
value="amount"
total="checkpoint"
orientation="horizontal"
format={(value) => euros.format(value)}
title="Du chiffre d’affaires au résultat"
height={340}
/>
);
}Opening balance
start opens the running total on an existing balance, with no checkpoint row to carry it. The legend, placed at the top here, is renamed through increaseLabel / decreaseLabel / totalLabel.
import { WaterfallChart } from "@synertech/ui";
export function OpeningBalance() {
return (
<WaterfallChart
data={[
{ move: "Nouveaux", count: 184 },
{ move: "Réactivés", count: 42 },
{ move: "Désabonnés", count: -96 },
{ move: "Expirés", count: -31 },
{ move: "Fin de mois", closing: true },
]}
x={{ key: "move" }}
value="count"
total="closing"
start={1_240}
legend="top"
increaseLabel="Entrées"
decreaseLabel="Sorties"
totalLabel="Abonnés"
title="Mouvement des abonnés"
description="Le mois ouvre sur 1 240 abonnés"
/>
);
}Click detail and table
onStepClick receives the step with the total before (start) and after (end) it; the table adds a column for that total, which the plot only hints at.
import { useState } from "react";
import { WaterfallChart, type WaterfallStep } from "@synertech/ui";
const budget = [
{ item: "Budget voté", amount: 1_240_000, checkpoint: true },
{ item: "Salaires", amount: -486_000 },
{ item: "Infogérance", amount: -212_000 },
{ item: "Licences", amount: -98_000 },
{ item: "Refacturation", amount: 64_000 },
{ item: "Subvention", amount: 130_000 },
{ item: "Réalisé", checkpoint: true },
];
const euros = new Intl.NumberFormat("fr-FR", {
style: "currency",
currency: "EUR",
notation: "compact",
});
export function Interactive() {
const [step, setStep] = useState<WaterfallStep | null>(null);
return (
<div className="flex flex-col gap-3">
<WaterfallChart
data={budget}
x={{ key: "item" }}
value="amount"
total="checkpoint"
format={(value) => euros.format(value)}
tableView="toggle"
valueLabel="Contribution"
title="Exécution budgétaire 2026"
onStepClick={setStep}
/>
{step ? (
<p className="text-sm text-gray-600 dark:text-gray-300">
{step.label} : {step.formattedValue}, cumul porté à {step.formattedEnd}
</p>
) : null}
</div>
);
}API reference
Components
How one figure became another.
Every contribution between a start and an end, floating between the running total before it and after it — the budget variance chart. It answers a question no other shape of the kit can: a bar chart of the same steps shows their sizes and says nothing about how they add up.
Colour comes from the diverging pair, because that is exactly what a step is: a move above or below the running total. It says the direction, never the verdict — a cost falling and a revenue falling wear the same colour, and the row label is what tells them apart.
The order of the rows IS the chart, so there is no sort: reordering the steps of a waterfall produces a different, and usually false, story.
import { WaterfallChart } from "@synertech/ui";Props — WaterfallChartProps
| Prop | Type | Default | Description |
|---|---|---|---|
data• |
ChartDatum[] |
— | One row per step, in the order they are read. |
value• |
string |
— | Field holding what the step adds to, or takes from, the running total. |
x• |
ChartXAxisConfig |
— | Field holding the name of each step. |
actions |
ReactNode |
— | Slot on the right of the caption: an export button, a range picker. A filter that frames several panels belongs in a |
barSize |
number |
— | Caps the thickness of a mark. |
colors |
{ increase?: string; decrease?: string; total?: string } |
— | Replaces the three colours. Any CSS colours. |
connectors |
boolean |
true |
Draws the thin rule joining one bar to the next. On by default, and it is not decoration: without it a floating bar has no visible tie to the one before, and the chart reads as a set of unrelated marks rather than as one running total. |
decreaseLabel |
string |
— | |
description |
ReactNode |
— | |
emptyState |
ReactNode |
— | Replaces the "no data" state: usually an |
error |
boolean |
false |
The data could not be loaded. Never the same thing as having none: a panel that says "no data" after a failed request states something false, and offers no way out. |
errorState |
ReactNode |
— | Replaces the whole built-in error state, message and button included. |
format |
(value: number) => string |
— | |
grid |
ChartGridLines |
"y" |
|
height |
number |
280 |
|
increaseLabel |
string |
— | |
legend |
boolean | ChartLegendPosition |
— | |
loading |
boolean |
false |
Dims the plot while fresh data loads; a first load shows a spinner. |
locale |
string |
— | BCP 47 tag the numbers and the dates are written in. Defaults to the |
margin |
Partial<ChartMargin> |
— | |
onRetry |
() => void |
— | Draws the retry button in the error state, and is called when pressed. |
onStepClick |
(step: WaterfallStep) => void |
— | Called with the mark that was clicked. Enter and Space on the focused chart do the same for the mark the keyboard is on. |
orientation |
CartesianOrientation |
"vertical" |
|
plotLabel |
string |
— | |
showValues |
boolean |
true |
Writes each step's contribution at the end of its bar, where it fits. |
size |
ChartSize |
"md" |
|
start |
number |
0 |
Figure the running total starts from. Defaults to |
tableView |
boolean | "toggle" |
false |
|
title |
ReactNode |
— | |
tooltip |
boolean | ((step: WaterfallStep) => ReactNode) |
true |
|
total |
string |
— | Field marking a row as a checkpoint rather than a contribution. A truthy value draws the bar from zero to the running total instead of floating it — the opening balance, a subtotal, the closing figure. When such a row also carries a |
totalLabel |
string |
— | Header of the running total column, and label of the total legend entry. |
valueLabel |
string |
— | Header of the contribution column of the data table. |
width |
number |
— | |
y |
ChartYAxisConfig |
— |
+ 277 inherited native attributes from HTMLAttributes, AriaAttributes, DOMAttributes (className, id, aria-*, event handlers…).
Types
WaterfallStep
InterfaceOne step, as the tooltip, the legend and the click handler see it.
interface WaterfallStep| Field | Type | Default | Description |
|---|---|---|---|
datum• |
ChartDatum |
— | |
end• |
number |
— | Running total the bar grows to. |
formattedEnd• |
string |
— | The running total after the step, formatted. |
formattedValue• |
string |
— | |
index• |
number |
— | |
kind• |
WaterfallKind |
— | |
label• |
string |
— | |
start• |
number |
— | Running total the bar grows from. |
value• |
number | null |
— | The contribution of the step, or the figure a total row lands on. |
x• |
ChartXValue |
— |
WaterfallKind
TypeWhat a step does to the running total.
type WaterfallKind = "increase" | "decrease" | "total"