# WaterfallChart

Signed changes and checkpoints along a running total.

Connect Flood once using [the installation guide](https://flood.md/docs/installation). Then import the components you use; no per-component add command is needed.

## Example

```tsx
"use client";

import { FloodRoot, WaterfallChart } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <WaterfallChart label="Net revenue (USD)" steps={[
        {id:"gross", label:"Gross", value:32000, kind:"total"},
        {id:"refunds", label:"Refunds", value:-4500},
        {id:"fees", label:"Fees", value:-2500},
        {id:"net", label:"Net", value:25000, kind:"total"}
      ]} />
    </FloodRoot>
  );
}
```

## Design notes

- A change adds its signed value to the running total. A total is an absolute checkpoint that replaces the running total.
- Use the same domain for charts you want to compare. It must contain zero and every intermediate total. Use formatValue to add units.
- Hover, tap or use the keyboard to inspect exact changes and running totals. Decreases use a dashed outline.

## API reference

| Prop | Values | Default |
| --- | --- | --- |
| `label` | `string` | `Required` |
| `steps` | `readonly WaterfallChartStep[]` | `Required` |
| `domain` | `readonly [number, number]` | `—` |
| `formatValue` | `(value: number) => string` | `—` |
| `changeLabel` | `string` | `—` |
| `totalLabel` | `string` | `—` |
| `emptyLabel` | `string` | `—` |
| `navigationLabel` | `string` | `—` |
| `Native HTML props` | `Omit<HTMLAttributes<HTMLDivElement>, "children" \| "role" \| "aria-label">` | `Forwarded` |
