A GitHub-style contribution heatmap. Date-aware, themeable buckets, weekday/month labels, click handlers, and tooltips.
bunx --bun shadcn@latest add https://ui.ahmet.studio/r/activity-heatmap
import { ActivityHeatmap } from "@/components/ui/activity-heatmap"; export function Demo() { const data = [ { date: "2025-01-01", value: 4 }, { date: "2025-01-02", value: 1 }, { date: "2025-01-03", value: 9 }, ]; return ( <ActivityHeatmap data={data} formatTooltip={(d) => `${d.value} contributions on ${d.date}`} onCellClick={(d) => console.log(d)} /> ); }
thresholds array.colorScale of Tailwind classes.weeks={26} for the last 6 months, or explicit startDate/endDate.weekStartsOn for Sun/Mon-start weeks.| Prop | Type | Default |
|---|---|---|
data | { date: string; value: number; label?: string }[] | Required |
weeks | number | 53 |
startDate | Date | string | undefined |
endDate | Date | string | today |
weekStartsOn | 0 | 1 | 0 |
levels | number | 5 |
thresholds | number[] | auto |
cellSize | number | 12 |
cellGap | number | 3 |
colorScale | string[] | green scale |
showWeekdayLabels | boolean | true |
showMonthLabels | boolean | true |
showLegend | boolean | true |
formatTooltip | (day) => ReactNode | undefined |
onCellClick | (day, event) => void | undefined |