Ir al contenido

CalendarHeatmap

Un cuadrado por día, en semanas, sombreado según cuánto pasó: despliegues, errores, registros a lo largo de un año. Un solo color, de claro a fuerte.

import { CalendarHeatmap, CalendarHeatmapSkeleton } from '@sypnia/ui/react'

En esta página
  1. Despliegues en un año
  2. Skeleton
  3. Cuándo usarlo
  4. Para todos
  5. Props

Despliegues en un año

Deploys
Every day of 2026
lun
mar
mié
jue
vie
sáb
dom
Ver como tabla
TotalDías con actividad
enero de 20263115
febrero de 20262912
marzo de 20262714
abril de 20262916
mayo de 20263415
junio de 20262313
julio de 20263819
agosto de 20263617
septiembre de 20264018
octubre de 20268218
noviembre de 20269218
diciembre de 202610520
Código
import { CalendarHeatmap } from '@sypnia/ui/react';

// One square per day of the year, shaded by how many deploys there were. Hover or focus a day to read it.
const values: Record<string, number> = {};
const start = new Date(2026, 0, 1);
for (let i = 0; i < 365; i++) {
  const d = new Date(start); d.setDate(d.getDate() + i);
  const weekday = d.getDay(), seed = (i * 7919) % 97;
  const n = weekday === 0 || weekday === 6 ? (seed % 9 === 0 ? 1 : 0) : seed % 6 === 0 ? 0 : (seed % 5) + (i > 280 ? 3 : 0);
  if (n) values[`${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`] = n;
}
export default function Deploys() {
  return <CalendarHeatmap title="Deploys" subtitle="Every day of 2026" unit="deploys" from="2026-01-01" to="2026-12-31" values={values} />;
}

Skeleton

Sign-ups
lun
mar
mié
jue
vie
sáb
dom
Ver como tabla
TotalDías con actividad
septiembre de 202641
octubre de 2026112
noviembre de 2026121
Código
import { CalendarHeatmap, CalendarHeatmapSkeleton } from '@sypnia/ui/react';

// A quarter and its skeleton: the same weeks, empty.
export default function Skeleton() {
  return (
    <div className="sy-stack">
      <CalendarHeatmap title="Sign-ups" unit="sign-ups" from="2026-09-01" to="2026-11-30" values={{ '2026-09-14': 4, '2026-10-02': 9, '2026-10-21': 2, '2026-11-17': 12 }} />
      <CalendarHeatmapSkeleton weeks={14} />
    </div>
  );
}

Cuándo usarlo

Úsalo cuando

  • Hábitos y ritmos a lo largo de meses: qué días hay mucho, qué días hay poco.

No lo uses cuando

  • Comparaciones exactas entre días: usa BarChart.
  • Menos de unas pocas semanas: un BarChart se lee mejor.

Para todos

  • Cada día es una celda con su fecha y su cantidad; Tab llega al calendario una vez y las flechas se mueven entre días.
  • «Ver como tabla» suma cada mes.

Props

CalendarHeatmapTipoPor defecto
fromobligatorio

The first and last day shown, as «2026-01-01».

string
titleobligatorio ReactNode
toobligatorio string
valuesobligatorio

By day, as «2026-11-17»: the amount of that day. Days left out had nothing.

Record<string, number>
empty ReactNode
error ReactNode
formatValue Fmt
height number
loading boolean
subtitle

What is plotted and in what unit: «Requests per minute, last 24 hours».

ReactNode
unit

What is counted, for the tooltip and the table: «deploys».

string
weekStart

1 for weeks that start on Monday, 0 for Sunday.

0 | 1 1
CalendarHeatmapSkeletonTipoPor defecto
weeks number 53
  1. Despliegues en un año
  2. Skeleton
  3. Cuándo usarlo
  4. Para todos
  5. Props

    Busca páginas, secciones y términos