Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-calendar-heatmap>

@methane-ui/ui~7.9 KB brotli (cold + Lit)~2.0 KB marginal

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

Interactive StageLive Custom Element · <mth-calendar-heatmap> (@methane-ui/ui)
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>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
values—ReadonlyArray<unknown>—Array of { date: string; count: number } contribution entries.
datadatastring""Declarative YYYY-MM-DD:count comma-separated entries for HTML/SSR.
endDateend-datestring""Inclusive ISO end date (YYYY-MM-DD) anchoring the heatmap window.
weeksweeksnumber12Number of week columns displayed.
selectedDateselected-datestring""Currently selected ISO date (YYYY-MM-DD).
labellabelstring""Accessible label for the role="grid" container.

Events

EventDetail TypeDescription
mth-select{ date: string; count: number }Emitted when a user selects a day cell.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowRightltrA heatmap day cell has focusMoves focus to next week in same weekday row
ArrowLeftrtlA heatmap day cell has focus in RTLMoves focus to next week in same weekday row
ArrowDownbothA heatmap day cell has focusMoves focus to next weekday row in same week
ArrowUpbothA heatmap day cell has focusMoves focus to previous weekday row in same week
HomebothA heatmap day cell has focusMoves focus to first day cell
EndbothA heatmap day cell has focusMoves focus to last day cell
EnterbothA heatmap day cell has focusSelects date and emits mth-select
bothA heatmap day cell has focusSelects date and emits mth-select

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="none" with host role="grid".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 8 APG keyboard transitions across LTR/RTL.mth-calendar-heatmap.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(has-selection).Conformance suite
i18nRoutes 4 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test