panelui

Day Grid

Component

About

A run of days as a field of dots, each sized by how much happened on it.

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

Code

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

Usage.tsx

'use client';

import { useState } from 'react';
import { DayGrid, type DayCell, type DayLevel } from '@/components/ui/panel-day-grid';
/** Pull requests merged on each day of a four-week sprint. */
const MERGED = [3, 5, 2, 7, 4, 0, 0, 6, 9, 4, 5, 8, 1, 0, 2, 4, 11, 6, 3, 0, 0, 7, 5, 8, 10, 6, 0, 1];

const levelOf = (count: number): DayLevel =>
  count === 0 ? 0 : count < 3 ? 1 : count < 6 ? 2 : count < 9 ? 3 : 4;

const START = new Date(2026, 8, 7);

const dateOf = (index: number) => {
  const day = new Date(START);
  day.setDate(START.getDate() + index);
  return day.toLocaleDateString('en-GB', { weekday: 'long', day: 'numeric', month: 'long' });
};

const CELLS: DayCell[] = MERGED.map((count, index) => ({
  level: levelOf(count),
  label: `${dateOf(index)}, ${count} merged`,
}));

export default function DayGridPickADay() {
  const [day, setDay] = useState<number | null>(16);

  return (
    <div className="flex w-full max-w-64 flex-col gap-4">
      <DayGrid
        cells={CELLS}
        columns={7}
        color="info"
        value={day}
        onValueChange={setDay}
        label="Pull requests merged"
      />
      <DayGrid.Caption>
        <DayGrid.Title>{day === null ? 'Pick a day' : `${MERGED[day]} merged`}</DayGrid.Title>
        <DayGrid.Description>{day === null ? '\u00a0' : dateOf(day)}</DayGrid.Description>
      </DayGrid.Caption>
    </div>
  );
}

Dependencies

More by panelui

View all
  • Spinner

    Spinner

    7
  • Flow

    Flow

    3
  • Treemap Chart

    Treemap Chart

    1
  • Soundwave

    Soundwave

    1
  • Share

    Share

    1
  • Scatter Chart

    Scatter Chart

    1
  • Pyramid Chart

    Pyramid Chart

    1
  • Model Picker

    Model Picker

    1