← All Components
<mth-calendar-heatmap>
Accessible contribution calendar heatmap using CalendarCore date math and 2D RovingFocusController keyboard navigation across day cells.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-calendar-heatmap>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/calendar-heatmap"></script>
<mth-calendar-heatmap weeks="12"></mth-calendar-heatmap>import '@methane-ui/ui/calendar-heatmap';
import '@methane-ui/react';
export function Example() {
return <mth-calendar-heatmap weeks="12"></mth-calendar-heatmap>;
}<script setup lang="ts">
import '@methane-ui/ui/calendar-heatmap';
</script>
<template>
<mth-calendar-heatmap weeks="12"></mth-calendar-heatmap>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/calendar-heatmap';
import { MthCalendarHeatmapDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthCalendarHeatmapDirective],
template: `<mth-calendar-heatmap weeks="12"></mth-calendar-heatmap>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/calendar-heatmap';
import MthCalendarHeatmap from '@methane-ui/svelte/MthCalendarHeatmap.svelte';
</script>
<MthCalendarHeatmap weeks="12"></MthCalendarHeatmap>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
values | — | ReadonlyArray<unknown> | — | Array of { date: string; count: number } contribution entries. |
data | data | string | "" | Declarative YYYY-MM-DD:count comma-separated entries for HTML/SSR. |
endDate | end-date | string | "" | Inclusive ISO end date (YYYY-MM-DD) anchoring the heatmap window. |
weeks | weeks | number | 12 | Number of week columns displayed. |
selectedDate | selected-date | string | "" | Currently selected ISO date (YYYY-MM-DD). |
label | label | string | "" | Accessible label for the role="grid" container. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-select | { date: string; count: number } | Emitted when a user selects a day cell. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowRight | ltr | A heatmap day cell has focus | Moves focus to next week in same weekday row |
| ArrowLeft | rtl | A heatmap day cell has focus in RTL | Moves focus to next week in same weekday row |
| ArrowDown | both | A heatmap day cell has focus | Moves focus to next weekday row in same week |
| ArrowUp | both | A heatmap day cell has focus | Moves focus to previous weekday row in same week |
| Home | both | A heatmap day cell has focus | Moves focus to first day cell |
| End | both | A heatmap day cell has focus | Moves focus to last day cell |
| Enter | both | A heatmap day cell has focus | Selects date and emits mth-select |
both | A heatmap day cell has focus | Selects date and emits mth-select |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="none" with host role="grid". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 8 APG keyboard transitions across LTR/RTL. | mth-calendar-heatmap.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(has-selection). | Conformance suite |
| i18n | Routes 4 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |