themeocean

Calendar Heatmap

Dashboards

About

A GitHub-style activity grid with one square per day, month and weekday labels, a hover tooltip and a legend. Fully keyboard navigable, with sample data built in and no extra dependencies.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Calendar Heatmap to your project and fits it to your theme.

Code

How Calendar Heatmap is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

// This is a file with a demo for your component
// That's what users will see in the preview
// Create new files in this directory to add more demos

"use client";

import * as React from "react";
import { GitCommitHorizontal } from "lucide-react";
import { Component, type HeatmapDay } from "@/components/ui/calendar-heatmap";
import { cn } from "@/lib/utils";

const RANGES = [
  { label: "6 months", weeks: 26 },
  { label: "1 year", weeks: 52 },
];

export default function DemoOne() {
  const [range, setRange] = React.useState(1);
  const [picked, setPicked] = React.useState<HeatmapDay | null>(null);

  return (
    <div className="flex min-h-[420px] w-full flex-col items-center justify-center gap-5 bg-background px-4 py-10 text-foreground">
      <div className="flex w-full max-w-4xl flex-wrap items-center justify-between gap-3">
        <div className="flex items-center gap-2.5">
          <span className="grid size-9 place-items-center rounded-lg bg-primary text-primary-foreground">
            <GitCommitHorizontal className="size-4" aria-hidden="true" />
          </span>
          <div>
            <h2 className="text-base font-semibold leading-5">Commit activity</h2>
            <p className="text-xs text-muted-foreground">Hover a day, or use the arrow keys</p>
          </div>
        </div>

        <div role="group" aria-label="Time range" className="inline-flex rounded-full border border-border bg-card p-0.5">
          {RANGES.map((r, i) => (
            <button
              key={r.label}
              type="button"
              aria-pressed={range === i}
              onClick={() => setRange(i)}
              className={cn(
                "h-8 rounded-full px-4 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
                range === i ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:text-foreground"
              )}
            >
              {r.label}
            </button>
          ))}
        </div>
      </div>

      <Component key={RANGES[range].weeks} weeks={RANGES[range].weeks} unit="commit" onDayClick={setPicked} />

      <p className="h-4 text-xs text-muted-foreground" role="status">
        {picked ? "Selected " + picked.date + ": " + picked.count + " commits" : ""}
      </p>
    </div>
  );
}

More by themeocean

View all
  • Interactive Tech Stack Bento Grid with Hover Effects

    Interactive Tech Stack Bento Grid with Hover Effects

    781
  • Floating Glassmorphic Navbar with Morphing Pill Indicator

    Floating Glassmorphic Navbar with Morphing Pill Indicator

    88
  • Mac-Style Floating Dock

    Mac-Style Floating Dock

    79
  • Nexus 3D Animated Login - Futuristic Authentication UI

    Nexus 3D Animated Login - Futuristic Authentication UI

    72
  • Animated 3D Perspective Hero with Floating Glass Layers

    Animated 3D Perspective Hero with Floating Glass Layers

    51
  • Interactive AI Agent Workflow Node Card

    Interactive AI Agent Workflow Node Card

    39
  • Interactive LLM Token & Context Window Visualizer

    Interactive LLM Token & Context Window Visualizer

    31
  • Interactive AI Voice Assistant Audio Visualizer

    Interactive AI Voice Assistant Audio Visualizer

    24

More in Dashboards

View all
  • Fernly — Project Management Dashboard with Kanban

    Fernly — Project Management Dashboard with Kanban

    774
  • Analytics Dashboard

    Analytics Dashboard

    89
  • Creator Dashboard

    Creator Dashboard

    222
  • Insights Dashboard

    Insights Dashboard

    47
  • Corbel — Sales Analytics Dashboard

    Corbel — Sales Analytics Dashboard

    500
  • serf dashboard

    serf dashboard

    146
  • Dashboard with Collapsible Sidebar

    Dashboard with Collapsible Sidebar

    2.7K
  • Halden — CRM Dashboard with Sales Pipeline

    Halden — CRM Dashboard with Sales Pipeline

    74