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

<mth-date-picker>

@methane-ui/ui~11.2 KB brotli (cold + Lit)~3.8 KB marginal

Form-associated accessible date picker powered by CalendarCore, OverlayController, PositioningController, and FormattingUtils.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/date-picker"></script>
<mth-date-picker placeholder="YYYY-MM-DD"></mth-date-picker>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
valuevaluestring""Selected date in YYYY-MM-DD ISO format.
namenamestring""Form field name submitted with parent <form>.
labellabelstring""Accessible field label.
placeholderplaceholderstring"YYYY-MM-DD"Placeholder text for the date input.
minminstring""Minimum selectable ISO date (YYYY-MM-DD).
maxmaxstring""Maximum selectable ISO date (YYYY-MM-DD).
openopenbooleanfalseWhether the calendar popover is open.
disableddisabledbooleanfalseDisables interaction and form submission.
readonlyreadonlybooleanfalsePrevents changing the selected date.
requiredrequiredbooleanfalseMarks a date selection as required.

Events

EventDetail TypeDescription
mth-change{ value: string }Fired when the selected date changes.
mth-open{ open: true }Cancelable event fired before opening the calendar.
mth-after-open{ open: true }Fired after opening completes.
mth-close{ reason: string }Fired when the calendar closes.
mth-after-close{ reason: string }Fired after closing and focus restore complete.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowDownbothInput or trigger is focused and popover closedOpens calendar popover and focuses active day
ArrowLeftbothCalendar grid cell is focusedMoves focus one day backward (RTL-aware)
ArrowRightbothCalendar grid cell is focusedMoves focus one day forward (RTL-aware)
ArrowUpbothCalendar grid cell is focusedMoves focus seven days backward
EnterbothCalendar grid cell is focusedSelects focused date, updates value, and closes popover
EscapebothCalendar popover is openCloses popover and restores focus

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 6 APG keyboard transitions across LTR/RTL.mth-date-picker.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(open), :state(disabled), :state(readonly), :state(dirty), :state(touched), :state(invalid).Conformance suite
i18nRoutes 4 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test