StealThis .dev

Calendar Heatmap

A GitHub-style contribution calendar heatmap. Renders a full year of daily data cells with color intensity levels, week/month labels, and an interactive tooltip showing date and value on hover.

Open in Lab
vanilla-js svg react tailwind vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Features

  • Full year view — 52 weeks × 7 days rendered as small SVG cells
  • 5 intensity levels — color scale from 0 activity to max
  • Month labels — correctly positioned month boundaries
  • Day labels — Mon/Wed/Fri labels on the left axis
  • Hover tooltip — date + value shown on cell hover
  • Responsive — scales to container width

How it works

  1. A year of dates is generated and bucketed by ISO week number
  2. Each cell is an SVG <rect> with fill mapped to a 5-stop color scale
  3. title elements provide accessible hover text
  4. Month boundary positions are computed by counting week-column changes