Block 263 of 297
Waterfall Chart
Walk from a starting value through each increase and decrease to a calculated ending total.
- Puck key
- WaterfallChartBlock
- Export
- waterfallChartBlock
- React component
- <WaterfallChart />
- Path
- components/puck/waterfall-chart-block.tsx
- Dependencies
- None
- License
- MIT
About this block
When to use it, how to write for it, and what to change in the code.
What it's for
Walks from a starting value through each increase and decrease to a calculated ending total, with dashed connectors between steps. Increases are solid, decreases are hatched and signed, and totals are darkest. The ending value and net change print above the chart. Value labels and some step labels hide as steps get crowded in narrow cards. Values accept P1 data bindings.
- How an operating budget changed from one year to the next
- Bridging last year's enrollment to this year's through gains and losses
- Explaining the gap between a fundraising goal and the amount raised
Writing the content
- Enter Change values with a sign: 120 adds, -45 subtracts. Rows with no number are skipped.
- Don't type the ending total; the block calculates it, so check it against your source figure.
- Use short Label text. Past seven bars, every other step label hides on narrow cards. Changes accept up to 14 rows.
- Put the unit in Value suffix, like k or M, and mention it in the subtitle.
Accessibility
- Decreases are hatched and carry a minus sign, so they never rely on color to read as negative (WCAG 1.4.1).
- The chart has role="img" with a summary stating the start, what each step adds or subtracts, the end and the net change.
- "View data table" lists each step's change and running total in a real table with row headers.
Customizing the code
- Bar styles are bg-indigo-600 for totals, bg-indigo-400 for increases and the stroke-indigo-600 hatch pattern for decreases.
- Chart height is CHART_HEIGHT, h-52 @md:h-64.
Editor fields
What content editors see in the P1 sidebar when they select this block.
- Titletext
- Heading levelselect
- Subtitle or periodtext
- Starting bar labeltext
- Starting valuetext
- Changesarray
- Ending bar labeltext
- Value prefixtext
- Value suffixtext
- Footnotetext