Calendar Heatmap
A year of daily counts as week columns, with month labels, five levels and streak stats.
PROGet Calendar Heatmap and 168 other Pro components with pro lifetime — Get Pro
- Category
- Data & feedback
- Access
- ProPro · unlocked
- Source
- 291 lines · one file
- States
- 5 drawn
The decision inside it
Quartiles, not a smooth ramp
One huge day on a smooth ramp turns every other day the same pale shade. Cutting levels at the quartiles keeps an ordinary week readable.
When to use it
Use Calendar Heatmap for a year of daily counts as week columns with month labels, five levels and streak stats (current, longest, active days, total). Dates are YYYY-MM-DD strings.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Calendar Heatmap for this.
Install it: npx shadcn@latest add @liro/calendar-heatmap
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/calendar-heatmap.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { CalendarHeatmap, type DayValue } from "@/components/ui/calendar-heatmap";
export function Activity({ days }: { days: DayValue[] }) {
return <CalendarHeatmap values={days} label="documents signed" description="Documents signed per day, last 12 months" />;
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
values | DayValue[] | Yes | – |
end | string | No | Last day shown, "YYYY-MM-DD". Default: the latest date in `values`. |
weeks | number | No | Weeks shown. Default 53 (a year). |
weekStart | "monday" | "sunday" | No | Week starts on. Default "monday". |
label | string | No | What is counted, plural: "documents signed". |
stats | boolean | No | Show the streak stats above the grid. Default true. |
description | string | Yes | Accessible summary. |
loading | boolean | No | – |
error | React.ReactNode | No | – |
onRetry | () => void | No | – |
className | string | No | – |
Dependencies
npm packages
clsxtailwind-mergeLiro foundations, installed alongside it
liro-themechartStates
All of them are drawn by the component. None is left for you to design.
- Default
- Weeks from Sunday
- Loading
- Empty
- Error
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances