# Waffle chart

A React component in [Beamline](https://beamline.io/)'s [Charts & data-vis](https://beamline.io/components/charts) category. Live demo: https://beamline.io/components/waffle-chart

Units of a whole as a grid of cells by category (seats used of a plan, tickets by channel): a 10×10 grid by default, hatched cells for units whose category was not recorded, the remainder left empty, and a list of categories with counts and shares that highlights its cells on hover or focus.

## Use it for

- A few shares of a whole that people should be able to count: seats by status, tickets by channel, survey answers.

## Not for

- Shares over time ([area-chart](https://beamline.io/components/area-chart) with expanded stacking).
- Many small categories ([bar-list](https://beamline.io/components/bar-list)).
- A quota with one used amount ([usage-meter](https://beamline.io/components/usage-meter)).

## Anatomy

- title, description, table button
- grid of cells (rows × columns; each cell is total ÷ cells units)
- cells by category in list order, then unmeasured (hatched), then the remainder (empty)
- category list (buttons): swatch, name, count, share

## Variants

- **0**: rows / columns (10 × 10 by default: one cell per percent)
- **1**: total (a plan size larger than the parts leaves empty remainder cells)
- **2**: unmeasured (units of unknown category)
- **3**: list on or off

## States

- loading (skeleton)
- empty
- unmeasured units: hatched cells and a hatched list row
- category with a null value: listed as “Not measured”, no cells
- active category (its cells lead, the rest dim; the list row is marked)
- pinned category (aria-pressed)
- table view (count and share per category)
- right-to-left: cells fill from the right

## Keyboard

- Tab moves through the category list; focus or hover highlights a category's cells
- Enter or Space pins it (aria-pressed); Escape clears the pin
- The grid itself is not focusable: the list carries every number

## Motion

Cells fade in once in fill order (one stagger step each); highlight is immediate on arrival. Instant under reduced motion.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `data` | `WaffleCategory[]` | — | { key, label, value: number \| null, color? } in fill order. |
| `total` | `number` | — | The whole; the sum of the parts by default. More than the sum leaves empty remainder cells. |
| `unmeasured` | `number` | — | Units whose category was not recorded; drawn hatched. |
| `remainderLabel` | `string` | — | What the empty remainder is called in the list. Default "Remaining". |
| `unmeasuredLabel` | `string` | — | What the hatched units are called in the list. Default "Not recorded". |
| `format` | `(value: number) => string` | — | How counts read: "62 seats". |
| `rows / columns` | `number` | — | Grid size. Default 10 × 10. |
| `active / defaultActive / onActiveChange` | `string \| null` | — | The pinned category's key. |
| `list` | `boolean` | — | The category list. Default true. |
| `title / hideTitle / description` | `string / boolean / ReactNode` | — | The figure's name (a heading unless hidden) is always its accessible name. |
| `table` | `boolean` | — | Offer “View as table”. Default true. |
| `loading` | `boolean` | — | Skeleton of the chart's shape; keeps the frame's size. |
| `actions` | `ReactNode` | — | Controls beside the legend (range, offset). |
| `className` | `string` | — | Lands on the figure. |
| `classNames` | `ChartClassNames` | — | Frame, tooltip and slice-list parts as applicable to this chart. |
| `style / ref` | `CSSProperties / Ref<HTMLElement>` | — | The native chart figure; layout measurement refs stay internal. |

## Dependencies

`motion`

## Import

```tsx
import { WaffleChart } from "@/components/waffle-chart/waffle-chart";
```

## Get it

Waffle chart is part of Beamline: 190 React components and screens your coding agent (Claude Code, Codex, Cursor or any MCP client) installs into your app through Beamline's MCP server, as a ready-built package or as plain React source you can change. $49 one payment (regular $200), no subscription, a year of updates, one licence for your whole team. [Get Beamline](https://beamline.io/checkout?pack=complete) · [Connect your agent](https://beamline.io/connect)

## More in Charts & data-vis

- [Activity heatmap](https://beamline.io/components/activity-heatmap): A calendar of daily counts, one cell per day on a sequential ramp: weeks across, weekdays down, month and weekday labels, a legend scale, hatched days…
- [Area chart](https://beamline.io/components/area-chart): Amounts over time as filled areas: overlapping, stacked or as shares of 100%, five fills, two strokes, five curves, a range handle; gaps for missing…
- [Bar chart](https://beamline.io/components/bar-chart): Amounts by category as bars: columns or rows, grouped, stacked or as shares, reference lines, five looks (rounded, cells, trace, isometric, monospace), a…
- [Composed chart](https://beamline.io/components/composed-chart): Different measures on one time axis: bars, lines and areas per series, a left and a right value axis with their own formats, and reference lines.
- [Gauge](https://beamline.io/components/gauge): One value against a known range: a semicircle, a 270° dial or a full ring, filled or with a needle, coloured bands with their names (healthy, busy…
- [Line chart](https://beamline.io/components/line-chart): Values over time as lines: curves, point markers, dashed series for forecasts, reference lines for limits and targets, an optional zero baseline and a…
- [Pie chart](https://beamline.io/components/pie-chart): A few shares of a whole as a pie or donut, with spaced slices, percent labels, a centre readout and a list of every slice with value and share; hovering…
- [Radar chart](https://beamline.io/components/radar-chart): A few series compared across the same five to eight dimensions as polygons on a polygon or circle grid; hover or arrow keys pick a dimension and read…
- [Radial chart](https://beamline.io/components/radial-chart): Progress of a few measures toward their targets as concentric rings, full or half circle, with a centre readout and a list of each ring's value, target…
- [Ridgeline](https://beamline.io/components/ridgeline): Distributions per group as overlapping density ridges (response time by region, order size by plan): an overlap control, median and p95 readouts per row…
- [Sankey chart](https://beamline.io/components/sankey-chart): Flows between stages as bands whose width is the amount: sources to pages to outcomes, budgets to teams; hovering or focusing a node lights its flows and…
- [Slope chart](https://beamline.io/components/slope-chart): Change between two points in time per item, by value or by rank: labels on both sides that never collide, rising and falling told by the end marker (▲ ▼)…
- [Sparkline](https://beamline.io/components/sparkline): A compact trend beside its value: point along it or focus it and use ← → to read each point; nulls are gaps. TrendLine is the bare line.
- [Streamgraph](https://beamline.io/components/streamgraph): Stacked flows over time around a centre baseline, with silhouette, wiggle, expand (shares) and zero offsets: a legend that turns layers on and off, a…
- [Treemap](https://beamline.io/components/treemap): Nested rectangles sized by value (spend by team, then service), squarified so tiles stay close to square: labels that fit or hide, hover and focus…
