Line chart
A multi-series line chart with a gliding crosshair, legend toggles, and paths that morph between ranges.
A ten by ten unit chart where every cell is one percent, and cells fly to their new group when the data changes.
npx shadcn@latest add @silicon-ui/waffle-chartnpx shadcn@latest add @silicon-ui/waffle-chartInstall the dependencies.
npm install motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/waffle-chart/waffle-chart.tsxcomponents/silicon-ui/waffle-chart/waffle-chart.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
| Prop | Type | Default |
|---|---|---|
data*Categories in fill order. The first fills from the bottom-left corner, column by column. | WaffleCategory[] | — |
label*What the whole is, such as "Electricity generation, 2023". Names the chart for assistive technology. | string | — |
unitUnit after each raw value in the tooltip and table, such as "TWh". | string | "" |
formatValue | (value: number, category: WaffleCategory) => string | — |
rowsGrid rows. rows × columns cells make the whole; 10 × 10 means one cell per percent. | number | 10 |
columns | number | 10 |
accentKeyThe category painted in the accent. Pass null to keep every category neutral. Defaults to the first category. | string | null | — |
activeKeyControlled focused category. Others dim while one is focused. | string | null | — |
defaultActiveKey | string | null | null |
onActiveChange | (key: string | null) => void | — |
legendCategory list with shares that roll to their new value. | boolean | true |
decimalsDecimal places for shares. | number | 0 |
emptyLabel | string | "No data" |
ref | Ref<HTMLElement> | — |
className | string | — |