Klar

Charts / React chart kit primitives / Part-to-whole

Waffle

A hundred squares coloured by share; here where every container is right now.

React component Waffle, data through props. How a total splits into its pieces. Tags: waffle, unit-chart, squares, share, percent, composition.

Install

npm i klar-charts

import 'klar-charts/styles.css'
import { ThemeScope, Waffle } from 'klar-charts'

# or copy the source:
npx shadcn@latest add https://klar.run/r/kit-waffle.json

Usage

<Waffle cols={10} total={100} cell={15} gap={3} segments={containerMix.map((c) => ({ value: (c.n / containerTotal) * 100, color: c.color }))} />

Related waffle charts