Heatmap

A GitHub-style contribution/activity heatmap for visualizing daily activity over time.

Playground

Hover over cells to see the value and date:

MarAprMayJunJulAugSepOctNovDecJanFebMonWedFri
Less
More

Props

Midnight
52
12
3
2
OffOn
OffOn
Code
<Heatmap
  data={data}
  theme="midnight"
  weeks={52}
  cellSize={12}
  cellGap={3}
  cellRadius={2}
  showMonthLabels
  showDayLabels
/>

Usage

tsx
import { Heatmap, type HeatmapDataPoint } from '@derpdaderp/chartkit';

const data: HeatmapDataPoint[] = [
  { date: '2024-01-01', value: 5 },
  { date: '2024-01-02', value: 3 },
  { date: '2024-01-03', value: 8 },
  // ...more data
];

<Heatmap
  data={data}
  theme="midnight"
  weeks={52}
  format={(value, date) => `${value} contributions on ${date}`}
/>

Props

PropTypeDefaultDescription
data*HeatmapDataPoint[]-Array of { date, value } objects
theme*ThemeName-Theme name
weeksnumber52Number of weeks to display
cellSizenumber12Cell size in pixels
cellGapnumber3Gap between cells
cellRadiusnumber2Cell border radius
showMonthLabelsbooleantrueShow month labels
showDayLabelsbooleantrueShow day labels
colorScalestring[]-Custom color scale array
format(value, date) => string-Tooltip formatter
emptyColorstring-Color for empty cells