← All Components
<mth-date-picker>
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
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>import '@methane-ui/ui/date-picker';
import '@methane-ui/react';
export function Example() {
return <mth-date-picker placeholder="YYYY-MM-DD"></mth-date-picker>;
}<script setup lang="ts">
import '@methane-ui/ui/date-picker';
</script>
<template>
<mth-date-picker placeholder="YYYY-MM-DD"></mth-date-picker>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/date-picker';
import { MthDatePickerDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthDatePickerDirective],
template: `<mth-date-picker placeholder="YYYY-MM-DD"></mth-date-picker>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/date-picker';
import MthDatePicker from '@methane-ui/svelte/MthDatePicker.svelte';
</script>
<MthDatePicker placeholder="YYYY-MM-DD"></MthDatePicker>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | "" | Selected date in YYYY-MM-DD ISO format. |
name | name | string | "" | Form field name submitted with parent <form>. |
label | label | string | "" | Accessible field label. |
placeholder | placeholder | string | "YYYY-MM-DD" | Placeholder text for the date input. |
min | min | string | "" | Minimum selectable ISO date (YYYY-MM-DD). |
max | max | string | "" | Maximum selectable ISO date (YYYY-MM-DD). |
open | open | boolean | false | Whether the calendar popover is open. |
disabled | disabled | boolean | false | Disables interaction and form submission. |
readonly | readonly | boolean | false | Prevents changing the selected date. |
required | required | boolean | false | Marks a date selection as required. |
Events
| Event | Detail Type | Description |
|---|---|---|
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
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowDown | both | Input or trigger is focused and popover closed | Opens calendar popover and focuses active day |
| ArrowLeft | both | Calendar grid cell is focused | Moves focus one day backward (RTL-aware) |
| ArrowRight | both | Calendar grid cell is focused | Moves focus one day forward (RTL-aware) |
| ArrowUp | both | Calendar grid cell is focused | Moves focus seven days backward |
| Enter | both | Calendar grid cell is focused | Selects focused date, updates value, and closes popover |
| Escape | both | Calendar popover is open | Closes popover and restores focus |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 6 APG keyboard transitions across LTR/RTL. | mth-date-picker.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(open), :state(disabled), :state(readonly), :state(dirty), :state(touched), :state(invalid). | Conformance suite |
| i18n | Routes 4 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |