Heatmap
Install Dependencies
npx quickcode-ui add HeatmapExamples
Default Heatmap
GitHub-Style Value Heatmap
Heatmap with Tooltip
Props
Heatmap
| Prop | Type | Default | Description |
|---|---|---|---|
data | number[][] | — | Heatmap matrix of values. |
colorFn | (value, row, col, min, max) => string | — | Full custom coloring logic. |
colorScale | string[] | — | Tailwind-based color bucket list. |
gap | number | 4 | Gap between heatmap cells (px). |
cellSize | number | 20 | Size of each cell (width + height). |
rowLabels | string[] | — | Optional labels for rows. |
colLabels | string[] | — | Optional labels for columns. |
min | number | — | Minimum value for color scaling. |
max | number | — | Maximum value for color scaling. |
caption | string | — | Accessible caption for the heatmap. |
onCellClick | (row: number, col: number, value: number) => void | — | Callback fired when a cell is clicked. |
Heatmap.Tooltip
| Prop | Type | Default | Description |
|---|---|---|---|
content | (value: number, row: number, col: number) => ReactNode | — | Custom JSX/UI to show inside tooltip. |
side | "top" | "right" | "bottom" | "left" | "top" | Tooltip position relative to cell. |
className | string | — | Additional CSS classes for tooltip. |
Last updated on