Waffle Chart
A 10 × 10 waffle of parts of a whole: each category gets its own tone, and hovering the legend lights its squares.
waffle-chart.tsxwaffle-chart.css
Checking access…
Overview
One hundred squares, one per percent. Categories step down a monochrome ramp (solid, two tints, outline, faint) so the chart survives greyscale and colour-blindness.
Hovering or focusing a legend item dims everything else and states its share.
When to use
- Shares in reports and editorial graphics.
When not to use
- More than five parts: use bars.
Installation
$
pnpm dlx shadcn@latest add https://sundaeui.dev/r/waffle-chart.json$
npx shadcn@latest add https://sundaeui.dev/r/waffle-chart.json$
yarn dlx shadcn@latest add https://sundaeui.dev/r/waffle-chart.json$
bunx --bun shadcn@latest add https://sundaeui.dev/r/waffle-chart.jsonWorks in any React project. Files are written to components/sundae/. Read the source in the stage’s Code view. Pro assets need a personal token. See authenticated installs.
- No dependencies beyond React 18 or later.
- Copy waffle-chart.tsx and waffle-chart.css into components/sundae/.
- The CSS file is imported by the component, so no extra configuration is needed.
- Import the component and use it as shown below.
Usage
import { WaffleChart } from '@/components/sundae/waffle-chart'
<WaffleChart />Props
| Prop | Type | Default |
|---|---|---|
parts*Parts; normalised to 100. | { name: string; value: number }[] | — |
fillSurface: dark or light. | 'dark' | 'light' | 'dark' |
Accessibility
- The grid is decorative; the legend lists every part with its percent.
- Legend items are buttons that highlight their squares.
- Reduced motion removes the movement and keeps every state change.
Customization
- Colours are CSS custom properties on .sd-wfl; override them in your own stylesheet.
- fill="light" switches the built-in light palette.
FAQ
- Is Waffle Chart free?
- Waffle Chart is part of Sundae Pro. The live preview is open to everyone; the source installs with a Pro account.
- How do I install Waffle Chart?
- Run npx shadcn@latest add https://sundaeui.dev/r/waffle-chart.json. The files are written to components/sundae/. It has no dependencies beyond React 18 or later.
- Does Waffle Chart support keyboard and screen readers?
- The grid is decorative; the legend lists every part with its percent. Legend items are buttons that highlight their squares.
- Does Waffle Chart respect reduced motion?
- Reduced motion removes the movement and keeps every state change.
More like this
All data →Stacked Bars
Data · Refined- Pro
Scrub Sparkline
Data · Refined - Pro
Tick Gauge
Data · Refined - Pro
Donut Breakdown
Data · Refined - Pro
Range Line Chart
Data · Refined Weather Forecast
Data · Refined