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'
Despliegues en un año
Deploys
Every day of 2026
lun
mar
mié
jue
vie
sáb
dom
Ver como tabla
| Total | Días con actividad | |
|---|---|---|
| enero de 2026 | 31 | 15 |
| febrero de 2026 | 29 | 12 |
| marzo de 2026 | 27 | 14 |
| abril de 2026 | 29 | 16 |
| mayo de 2026 | 34 | 15 |
| junio de 2026 | 23 | 13 |
| julio de 2026 | 38 | 19 |
| agosto de 2026 | 36 | 17 |
| septiembre de 2026 | 40 | 18 |
| octubre de 2026 | 82 | 18 |
| noviembre de 2026 | 92 | 18 |
| diciembre de 2026 | 105 | 20 |
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
| Total | Días con actividad | |
|---|---|---|
| septiembre de 2026 | 4 | 1 |
| octubre de 2026 | 11 | 2 |
| noviembre de 2026 | 12 | 1 |
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
| CalendarHeatmap | Tipo | Por defecto |
|---|---|---|
fromobligatorioThe first and last day shown, as «2026-01-01». | string | |
titleobligatorio | ReactNode | |
toobligatorio | string | |
valuesobligatorioBy 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 | |
subtitleWhat is plotted and in what unit: «Requests per minute, last 24 hours». | ReactNode | |
unitWhat is counted, for the tooltip and the table: «deploys». | string | |
weekStart1 for weeks that start on Monday, 0 for Sunday. | 0 | 1 | 1 |
| CalendarHeatmapSkeleton | Tipo | Por defecto |
|---|---|---|
weeks | number | 53 |