About
A matrix heatmap with a row per line and a column per label, e.g. weekday by hour, with hover highlighting and tooltips.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Heatmap Chart to your project and fits it to your theme.
Code
How Heatmap Chart is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import { HeatmapChart } from "@/components/ui/dashboardcn-heatmap-chart"
const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
const hours = Array.from({ length: 12 }, (_, i) => String(i * 2).padStart(2, "0"))
// Deterministic sample data so the demo is stable between renders: a working-hours
// peak on weekdays, a quieter and later curve at the weekend, plus some noise.
function sampleRows() {
let seed = 7
const random = () => {
seed = (seed * 1664525 + 1013904223) % 4294967296
return seed / 4294967296
}
return days.map((label, d) => {
const weekend = d >= 5
return {
label,
values: hours.map((_, h) => {
const hour = h * 2 + 1
const peak = weekend ? 15 : 14
const shape = Math.exp(-((hour - peak) ** 2) / (weekend ? 40 : 22))
const base = (weekend ? 90 : 320) * shape + (weekend ? 6 : 12)
return Math.round(base * (0.75 + random() * 0.5))
}),
}
})
}
const rows = sampleRows()
export default function HeatmapChartDemo() {
return (
<div className="w-full max-w-lg">
<HeatmapChart rows={rows} columns={hours} unit="sessions" />
</div>
)
}
















