Kinetik UI

Waffle Chart

.md

A ten-by-ten grid where each cell is one percent; cells fill in a wave and new data washes across the grid.

v1.0.0Live on webreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add waffle-chart

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/waffle-chart.json

Install manually

  1. Install dependencies
    npx expo install react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/waffle-chart.tsx
    View source files

Usage

import { WaffleChart } from '@/components/kinetik/waffle-chart';

<WaffleChart
  accessibilityLabel="Trip budget"
  data={[
    { label: 'Stays', value: 46 },
    { label: 'Flights', value: 28 },
    { label: 'Food', value: 17 },
  ]}
/>;

Values are percentages. If they add up to less than 100, the remaining cells stay empty, which makes "how much is left" easy to see.

When to use

  • Parts of a whole that people should be able to count: budgets, survey answers, storage.
  • Small numbers of slices, up to about five.

When not to use

  • Values that do not add up to a whole. Use Bar Chart.
  • Precise comparisons between similar shares. Cells round to whole percent.

Notes

  • Shares are rounded to whole cells with the largest-remainder method, so the cells always add up to the rounded total and never past a hundred. waffleCells is exported if you need the same counts elsewhere.
  • Tap a legend entry to dim every other slice; tap it again to clear.
  • The grid is square and takes the width it is given.
  • With reduced motion the grid appears filled and changes colour at once.

Props

WaffleChartProps

PropTypeDefaultDescription
datarequiredreadonly WaffleSlice[]—Shares in percent. They may add up to less than 100; the rest stays empty.
accessibilityLabelrequiredstring—What the chart shows, read first, e.g. "Where the budget goes".
colorsreadonly string[]—One colour per slice. Defaults to azure, sky, the theme ink and grey.
legendbooleantrueShow the legend under the grid. Defaults to true.
testIDstring—
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
A hundred plain views read three shared values, so a wave updates a hundred styles per frame for about a second. Nothing runs at rest.
Measured

Pixel 9 emulator, API 35, release build · interaction median 0.85× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 158 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
The grid appears filled and new data changes the colours at once.
Screen readers
One image whose name lists every slice and its share. Legend entries are buttons with a selected state.
Touch target
Legend entries are at least 44 pt tall.

Source files

components/kinetik/waffle-chart.tsx is in the Code tab of the preview above.