# C calendar heatmap 1

> Contributions — a year of daily activity

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/c-calendar-heatmap-1).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/c-calendar-heatmap-1
- Screenshot: https://shadcn.exchange/shot/cnippet/c-calendar-heatmap-1/light.png
- Registry item: https://ui.cnippet.dev/r/c-calendar-heatmap-1.json
- Categories: calendar heatmap
- Listed: 2026-10-27, source last changed 2026-10-27

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/cnippet/c-calendar-heatmap-1.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/calendar-heatmap`, `@cnippet/chart-card`

## Files

### `registry/default/chart-variants/c-calendar-heatmap-1.tsx`

```tsx
"use client";

import { CalendarHeatmap } from "@/registry/default/charts/calendar-heatmap";
import { ChartCard } from "@/registry/default/charts/chart-card";

const START = Date.UTC(2025, 9, 27);

// A year of deterministic contributions: more on weekdays, some quiet weeks.
const data = Array.from({ length: 365 }, (_, i) => {
  const date = new Date(START + i * 86_400_000);
  const weekend = date.getUTCDay() === 0 || date.getUTCDay() === 6;
  const quietWeek = Math.floor(i / 7) % 9 === 4;
  const base = ((i * 37) % 13) - 4;
  return {
    date: date.toISOString().slice(0, 10),
    value: quietWeek ? 0 : Math.max(0, weekend ? base - 3 : base),
  };
});
const total = data.reduce((sum, d) => sum + d.value, 0);

export default function Contributions() {
  return (
    <ChartCard
      className="max-w-3xl"
      description="Commits, reviews and issues, last 12 months"
      title={`${total.toLocaleString("en-US")} contributions`}
    >
      <CalendarHeatmap
        cellLabel={(day) => `${day.date}: ${day.value} contributions`}
        data={data}
        minCellSize={7}
        valueFormatter={(v) => String(v)}
      />
    </ChartCard>
  );
}
```
