Heatmap

A calendar where each day is a square, darker the bigger its value. Use it for activity over weeks, such as commits, check-ins or sales per day.

General

Pass the days in data, as YYYY-MM-DD keys with a number for each. Days without a value stay empty. Without dates, it shows the last year.

Legend and colors

withLegend explains the scale. Set type for a theme color, or colors for your own levels, from the lowest to the highest.

Week start and language

firstDayOfWeek goes from 0 (Sunday) to 6. locale translates the months and the weekdays.

APIs

Heatmap.Props

AttributeDescriptionTypeAccepted valuesDefault
datathe value of each day, with YYYY-MM-DD keysRecord<string, number>--
startDatefirst day shownstring | Date-a year before the end
endDatelast day shownstring | Date-today
typetheme color of the squaresNormalTypes'default', 'primary', 'secondary', 'success', 'warning', 'error', 'info'success
colorscolors of the levels, from the lowest to the higheststring[]-4 shades of type
firstDayOfWeekday that starts a week, 0 is Sundaynumber0 to 61
rectSizeside of a square, in pixelsnumber-12
gapspace between squares, in pixelsnumber-3
rectRadiuscorner radius of a square, in pixelsnumber-2
withMonthLabelsname the months above the columnsboolean-true
withWeekdayLabelsname Monday, Wednesday and Fridayboolean-true
withLegendshow the scale belowboolean-false
legendLabelstexts at the two ends of the legend[string, string]-Less, More
localelanguage of the months and the weekdaysstring-en-US
monthLabelsthe 12 month names, from Januarystring[]-from locale
weekdayLabelsthe 7 weekday names, from Sundaystring[]-from locale
valueLabeltext of the hover title of a day(date: string, value: number) => string-date: value
...native props, passed to the svgSVGAttributes'aria-label', 'className', ...-

Ref

The ref points at the svg.

Accessibility

Value is shown by color only, and each square has a hover title with its date and value. Describe the pattern with aria-label or aria-labelledby, such as "Commits in 2026, busiest in March". With a name it is an image. Without one it is hidden from assistive technology.

For the exact numbers, offer the same data in a Table next to the heatmap.

Edit this page on GitHub