Ripple Heatmap
anime.jsA weekday by hour grid. Press a cell and the grid ripples out from it.
Mon
Tue
Wed
Thu
Fri
Sat
Sun
Install
$ npx shadcn@latest add https://spotcheckui.com/r/ripple-heatmap.jsonAlso installs animejs.
Usage
import { RippleHeatmap } from "@/components/spotcheck/ripple-heatmap"
<RippleHeatmap
label="Requests per hour by weekday"
values={perHour}
rowLabels={["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]}
cellLabel={(cell) => `${cell.value} at ${cell.column}:00`}
onPick={setFocus}
/>values runs from 0 to 1, row by row. The whole grid is one tab stop, and arrow keys move inside it.
Props
- values * Required
number[]Default —One value from 0 to 1 per cell, row by row. - label * Required
stringDefault —Describes the grid for screen readers. - cols
numberDefault 24 - rowLabels * Required
string[]Default —One label per row, printed at the left. - cellLabel
(cell: HeatCell) => stringDefault —Names a cell for screen readers. - onPick
(cell: HeatCell) => voidDefault —Runs when a cell is pressed. - className
stringDefault —
Keyboard
| ← → ↑ ↓ | Move between cells |
|---|---|
| Home | Start of the row |
| End | End of the row |
| Enter | Pick the cell |
Reduced motion
Cells stay still, and picking one still works.