Controls

Heatmap

Effect
Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Heatmap

Sessions by day and hour
00h02h04h06h08h10h12h14h16h18h20h22h
Mon91063170118125138103873218
Tue01803766120124137105843812
Wed4136297511113412711673482
Thu15217198410314012212070492
Fri171162280108134129111803913
Sat8115244072698457561818
Sun0180283773698260512411

Heatmap

A grid of soft cells whose shade shows each value.

Installation

npx shadcn@latest add ikislay/pixel-ui/heatmap

How to use

import { Heatmap } from "@/components/ui/heatmap"
export function Demo() {
return (
<Heatmap
label="Orders by day and shift"
rows={["Mon", "Tue", "Wed"]}
columns={["Morning", "Noon", "Evening"]}
data={[
[12, 30, 18],
[9, 26, 22],
[14, 34, 27],
]}
/>
)

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
data*
number[][]

One array of values per row, in column order.

rows*
string[]

Labels down the left side.

columns*
string[]

Labels across the top. Some are skipped when the grid is too narrow to fit them all.

label*
string

Names the chart for screen readers and captions its data table.

format
(value: number) => string

Formats values wherever the chart shows them. Defaults to short numbers like 12.4K.

color
string

Any CSS color. The lowest value shows a faint tint of it and the highest shows it in full.

gap
number

Space between cells in pixels.

className
string

Merged onto the root element.