Calm motion: animations on this site only fade, with no movement
Waffle
Parts of a whole as a grid of 100 squares
Shows the share of each part as a count of squares. Each square is one percent, so "28 squares" reads as 28%. It is easier to compare than the slices of a pie. For a ring with the total in the middle, use the donut chart.
Basic
- Spotify55.7% · 6,240
- Apple Podcasts25.1% · 2,810
- YouTube13.7% · 1,530
- Other apps5.5% · 620
datais a list of parts. Each part has alabel, avalue, and an optionalcolor(a token name or any CSS color).- The squares fill row by row from the top, one part after the other. The counts are whole numbers that add up to 100.
- The legend shows the name, the share, and the value of each part.
formatsets the text of a value. - Set the size of a square with the
--bless-waffle-cellCSS variable (default14px). - For screen readers, the grid is hidden and the legend is a list.
labelnames the chart.
Usage
ts
import { BlessWaffle } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
data* | BlessWaffleSlice[] | — | |
format | ((v: number) => string) | — | text for one value, for example `(v) => v + " GB"` |
label | string | "Chart" | names the chart for screen readers |