Heatmap

Contribution-style grid. Cells pop in as a diagonal wave; a tooltip follows the pointer on a spring. Charts.

Open playground

About

Heatmap is a React component in the Charts category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Heatmap } from "@ashutoshswamy/smoui" and set data, rows, cell among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Heatmap } from "@ashutoshswamy/smoui";

<Heatmap data={Array.from({ length: 140 }, (_, i) => (i * 7) % 5)} rows={7} />

Props 4

data

Values in column order, rows cells per column.

number[]
rows

Cells per column.

numberdefault 7
cell / gap

Px.

numberdefault 14 / 4
describe

Tooltip text (a function; use it from a client component).

(value: number, index: number) => string