Xzero UI
Pro library

Activity heatmap

See a year of activity at a glance, one square per day.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/activity-heatmap
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/activity-heatmap

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { useState } from "react";
import { ActivityHeatmap } from "@/components/xzero/activity-heatmap/activity-heatmap";

export function Contributions({ days }: { days: { date: string; count: number }[] }) {
  const [selected, setSelected] = useState<string | null>(null);
  return (
    <ActivityHeatmap days={days} label="Contributions in 2026" period="2026" selectedDate={selected} onSelectDate={setSelected} />
  );
}

API reference

ActivityHeatmap

A contribution style calendar with one tinted square per day and a hover or focus tooltip.

PropTypeDefaultDescription
days (required){ date: string; count: number }[]–One entry per day as YYYY-MM-DD, oldest first. Missing days count as zero.
label (required)string–Accessible name for the grid, such as "Contributions in 2025".
period (required)string–Finishes the summary: "1,284 contributions in {period}".
unit{ one: string; other: string }{ one: "contribution", other: "contributions" }Nouns for the count.
thresholds[number, number, number]–Upper bounds for levels one to three. Defaults to quarters of the busiest day.
weekStartsOn0 | 10Sunday or Monday as the first row.
selectedDatestring | nullnullDay drawn with a selection ring.
onSelectDate(date: string) => void–Called on click, Enter, or Space.
actionsReactNode–Controls beside the summary, such as a range switch.
localestring"en-US"Formatting locale.
classNamestring–Class for the root.

Keyboard interactions

KeysAction
ArrowUp / ArrowDownMoves one day back or forward.
ArrowLeft / ArrowRightMoves one week back or forward.
Home / EndJumps to the first or last day.
Enter / SpaceSelects the focused day.
EscapeHides the tooltip.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in charts

Guidance for AI tools

Activity heatmap: See a year of activity at a glance, one square per day. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components