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.jsonSessions by device
Mobile 62.1%, Desktop 31.4%, Tablet 6.6%
WaffleChartWaffleTablewaffleCellswaffleLegendfoldWaffleItems- +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%
Mobile 62.1%, Desktop 31.4%, Tablet 6.6%
import { ChartCard } from "@/components/sheenui/charts/chart-parts/chart-card";
import { WaffleTable, WaffleChart, type WaffleItem } from "@/components/sheenui/charts/waffle-chart";
// Package build (after the first npm release, or a packed tarball): import { ChartCard, WaffleTable, WaffleChart, type WaffleItem } from "@sheenui/theme";
const data: WaffleItem[] = [
{ label: "Mobile", value: 61380, color: 1 },
{ label: "Desktop", value: 31020, color: 7 },
{ label: "Tablet", value: 6510, color: 3 },
];
<ChartCard title="Sessions by device" table={<WaffleTable data={data} caption="Sessions by device" />}>
<WaffleChart data={data} aria-label="Sessions by device" />
</ChartCard>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.tsxcomponents/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
Public transport 41%, Cycle or walk 27%, Car 24%, Work from home 8%
import { WaffleChart } from "@/components/sheenui/charts/waffle-chart";
// Package build (after the first npm release, or a packed tarball): import { WaffleChart } from "@sheenui/theme";
<WaffleChart
variant="pictogram"
data={[
{ label: "Public transport", value: 41, color: 7 },
{ label: "Cycle or walk", value: 27, color: 3 },
{ label: "Car", value: 24, color: 2 },
{ label: "Work from home", value: 8, color: 1 },
]}
aria-label="How employees commute"
/>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
Photos 30%, Apps 17.3%, Documents 7.3%, System 9.2%, Remainder 36.3%
import { WaffleChart, type WaffleItem } from "@/components/sheenui/charts/waffle-chart";
// Package build (after the first npm release, or a packed tarball): import { WaffleChart, type WaffleItem } from "@sheenui/theme";
const storage: WaffleItem[] = [
{ label: "Photos", value: 38.4, color: 5 },
{ label: "Apps", value: 22.1, color: 7 },
{ label: "Documents", value: 9.3, color: 4 },
{ label: "System", value: 11.8, color: 1 },
];
const oneDecimal = new Intl.NumberFormat("en", { maximumFractionDigits: 1 });
<WaffleChart
data={storage}
total={128}
rows={5}
columns={20}
format={(n) => `${oneDecimal.format(n)} GB`}
aria-label="iPhone storage, 128 GB"
/>Props
WaffleChartLabels keys and English defaults (9)
WaffleTable props
Keyboard
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
Related pages
48 charts pages in all: browse them on Charts.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .