Skip to content

Waffle Chart for React

A React waffle chart is a 10 × 10 grid where every cell is one percent, so “61 in 100” lands faster than any pie. Pass data as readonly WaffleItem[]: the parts of the whole.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/waffle-chart.json

Sessions by device

Use the arrow keys to read each part.

Mobile 62.1%, Desktop 31.4%, Tablet 6.6%

  • WaffleChart
  • WaffleTable
  • waffleCells
  • waffleLegend
  • foldWaffleItems
  • +4 more
  • +1 more

Share of a whole

Switch the quarter: only the cells that change hands pop. Hover a cell or a legend row, tap, or arrow through the parts.

Sessions by device

Q3 2026 · one cell = 1%

Use the arrow keys to read each part.

Mobile 62.1%, Desktop 31.4%, Tablet 6.6%

Files to copy

15 folders · 33 files · 4 packages
From theme/src/
  • components/charts/{waffle-chart.tsx, category-bar.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-pointer.tsx, chart-tip.tsx, chart-utils.ts, heatmap.tsx}
  • components/button/
  • components/charts/category-bar/
  • components/charts/chart-parts/
  • components/charts/heatmap/
  • components/drawer/parts/sheet.tsx
  • components/kbd/
  • components/menu/
  • components/skeleton/
  • components/spinner/
  • components/status-icons/
  • hooks/{use-controllable.ts, use-direction.ts, use-intersection.ts, use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}
  • motion/{gate.ts, tokens.ts}
  • lib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, popup-a11y.ts, popup-motion.ts, state-light.tsx, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/waffle-chart.jsonRegistry item: waffle-chart. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".

Pictogram

Any icon that uses currentColor, one per cell. Here: how 100 employees get to work.

How 100 employees commute

Use the arrow keys to read each part.

Public transport 41%, Cycle or walk 27%, Car 24%, Work from home 8%

Part of a larger whole

With a `total` above the sum, the rest of the cells stay empty. Any grid size works: here 20 × 5.

iPhone storage

81.6 GB of 128 GB used

Use the arrow keys to read each part.

Photos 30%, Apps 17.3%, Documents 7.3%, System 9.2%, Remainder 36.3%

Props

PropTypeDefaultDescription
data (required)readonly WaffleItem[]NoneThe parts of the whole. Negative values count as 0; more than 8 parts fold the smallest into "Other".
totalnumber0The whole. Default: the sum of the values. When larger, the rest of the cells stay empty.
rowsnumber10Number of grid rows; with columns it sets the grid size (10 × 10 = one cell per percent).
columnsnumber10Number of cells in each row of the grid; with rows it sets the grid size.
variant"grid" | "pictogram""grid""grid": rounded squares. "pictogram": icon in every cell (people, devices…).
iconReactNodePERSONThe pictogram's icon. Use currentColor: it's drawn in the part's colour.
fill"rows" | "columns""rows"Fill row by row (default) or column by column, from the start corner.
maxCellnumber28 (grid) / 32 (pictogram)Sets the largest cell in px.
showLegendbooleantrueShow each part's key, name and share beside (or under, when narrow) the grid.
format((n: number) => string)formatCompact in localeFormats a value for the labels, tooltips and data table: takes the number, returns the text shown.
formatPercent((ratio: number) => string)percentages in localeFormats a share of the whole for the labels, tooltips and data table: takes the share, returns the text shown.
localestring"en"Locale of the default number formats.
emptyStateReactNodeNoneShown when there is nothing to plot.
labelsPartial<WaffleChartLabels>defaultWaffleChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultWaffleChartLabels. All 9 keys of WaffleChartLabels are listed in the key table under the props table.
aria-label (required)stringNoneNames the chart for assistive tech.
classNamestringNoneAdds extra classes to the outer element.
WaffleChartLabels keys and English defaults (9)
Pass any key in labels; the rest keep the defaults of defaultWaffleChartLabels.
KeyEnglish default
instructionsUse the arrow keys to read each part.
otherOther
restRemainder
cells(n) => `${n} ${n === 1 ? "cell" : "cells"}`
itemItem
valueValue
shareShare
cellCountCells
emptyNo data

WaffleTable props

PropTypeDefaultDescription
data (required)readonly WaffleItem[]NoneThe parts of the whole. Negative values count as 0; more than 8 parts fold the smallest into "Other".
format((n: number) => string)formatCompact in localeFormats a value for the labels, tooltips and data table: takes the number, returns the text shown.
labelsPartial<WaffleChartLabels>defaultWaffleChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultWaffleChartLabels. All 9 keys of WaffleChartLabels are listed in the key table under the props table.
localestring"en"Locale of the default number formats.
rowsnumber10Number of grid rows; with columns it sets the grid size (10 × 10 = one cell per percent).
formatPercent((ratio: number) => string)percentages in localeFormats a share of the whole for the labels, tooltips and data table: takes the share, returns the text shown.
totalnumber0The whole. Default: the sum of the values. When larger, the rest of the cells stay empty.
columnsnumber10Number of cells in each row of the grid; with rows it sets the grid size.
captionstringNoneHidden caption that names the table for screen readers.

Keyboard

KeysAction
TabFocus the grid (one tab stop).
→/↓Next part (← in right-to-left layouts).
←/↑Previous part.
Home/EndFirst / last part.
EscapeStop reading.

Accessibility

  • The grid is one focusable figure whose description lists every part's share; the cells themselves are hidden from assistive tech, so nobody has to step through 100 of them.
  • Reading a part announces its value, share and cell count once.
  • The legend names every part next to its share, and the table view lists values, shares and cells: color is never the only cue.
  • Cells are split by largest remainder, so the cell counts always add up to the grid.
  • Reduced motion: no wave, no pop on change; the grid is drawn in place.

All exports on this page

  • WaffleChart — A 10 × 10 grid where each cell is one percent of a whole: shares people grasp at a glance ("62 in 100").
  • WaffleTable — Every part with its value, share and cell count (plus the empty remainder, if any).
  • defaultWaffleChartLabels — The built-in English strings of WaffleChart; spread it into your own labels and change what you need.
  • foldWaffleItems — More than 8 parts: the 7 largest keep their place (in your order) and their colour slot.
  • waffleCells — Cells per part, by largest remainder so they add up exactly.
  • waffleLegend — Legend for a waffle: each part's key, name and share, as the chart shows them.

When to use the waffle chart

  • Use it as a percentage grid chart to make a share land fast, such as sessions by device on a 10 by 10 grid where every cell is exactly one percent.
  • It fits storage or quota displays on a part of a larger whole, such as 81.6 GB of 128 GB used, with total above the sum leaving the rest of the cells empty.
  • The pictogram variant suits human-scale statistics, such as how 100 employees get to work, drawing any currentColor icon in each cell.
  • Skip it when precision matters or there are more than a handful of parts; BarChart is more accurate, and Meter or Progress fits a single completion value.
  • Pair it with ChartCard for the title and Chart / Table tabs, WaffleTable for the text twin, and NumberTicker to show the headline figure beside the grid.

Frequently asked questions

48 charts pages in all: browse them on Charts.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .