Component

Calendar Heatmap

Year-grid heatmap — the classic GitHub contributions layout.

Installation

import { WrCalendarHeatmap, type WrHeatmapDatum } from 'ngwr/calendar-heatmap';

@Component({ imports: [WrCalendarHeatmap] })
export class MyComponent {
  // Each cell: { date, value }. Higher value → darker shade.
  protected readonly contributions: WrHeatmapDatum[] = [
    { date: new Date('2026-01-15'), value: 3 },
    { date: new Date('2026-02-04'), value: 8 },
    { date: new Date('2026-03-22'), value: 5 },
    // ... one entry per active day
  ];
}

Basic

<wr-calendar-heatmap [data]="contributions" />

API

Inputs of <wr-calendar-heatmap>.

NameDescriptionTypeDefault
datareadonly WrHeatmapDatum[][]
ariaLabelAccessible name of the whole grid. Its cells are bare spans whose title a screen reader on a role-less element does not read, so the map used to be several hundred anonymous nodes with no name. Falls back to calendarHeatmap.label.string | nullnull
endDateLast day to render.string | Date | nulltoday
weeksNumber of weeks (columns) to render.number53
cellSizeCell side in CSS pixels.number11
cellGapPixel gap between cells.number2
colorCell fill colour at full intensity.stringprimary
emptyColorBackground colour for zero-value days.stringlight tint
showLabelsShow the weekday + month labels around the grid.booleantrue

Types

Data shapes used by the inputs above.

interface WrHeatmapDatum {
  date: string | Date;
  value: number;
}
NameDescriptionTypeDefault
WrHeatmapDatumOne contribution cell.interface
daterequiredISO date string (YYYY-MM-DD) or Date.string | Date
valuerequiredMagnitude — bucketed into intensity steps.number