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

<mth-calendar>

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

Accessible single-date WAI-ARIA calendar grid powered by CalendarCore and FormattingUtils with Temporal/Date fallback, min/max clamping, disabled dates, and RTL-aware roving grid keyboard navigation.

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> (@methane-ui/ui)
Ready · interact with <mth-calendar>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/calendar"></script>
<mth-calendar></mth-calendar>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
valuevaluestring""Selected date in ISO-8601 YYYY-MM-DD format.
minminstring""Minimum selectable date in ISO-8601 YYYY-MM-DD format.
maxmaxstring""Maximum selectable date in ISO-8601 YYYY-MM-DD format.
localelocalestring""BCP-47 locale override for month, weekday, and first-day-of-week localization.
disableddisabledbooleanfalseDisables all calendar navigation and day selection.
readonlyreadonlybooleanfalseAllows grid navigation without changing the selected date.
isDateDisabled—((iso: string) => boolean) | undefined—Optional predicate returning true when a given ISO date should be disabled.

Events

EventDetail TypeDescription
mth-change{ value: string }Emitted when a new date is selected.
mth-focus-date{ value: string }Emitted when the focused date moves inside the grid.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowRightbothDay button inside grid is focusedMoves focus one day forward (or backward in RTL)
ArrowLeftbothDay button inside grid is focusedMoves focus one day backward (or forward in RTL)
ArrowDownbothDay button inside grid is focusedMoves focus down one week (+7 days)
ArrowUpbothDay button inside grid is focusedMoves focus up one week (-7 days)
HomebothDay button inside grid is focusedMoves focus to first day of current week
EndbothDay button inside grid is focusedMoves focus to last day of current week
PageUpbothDay button inside grid is focusedMoves focus to previous month (or previous year with Shift)
PageDownbothDay button inside grid is focusedMoves focus to next month (or next year with Shift)

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusdelegatesFocus: true with zero host internals.role (ADR-014).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.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(disabled), :state(readonly).Conformance suite
i18nRoutes 7 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test