MiHCM
primitives/@mihcm/ui·v0.21.0·stable

DatePicker

DayPicker v10-backed trigger + popover for single dates, ranges, date-time, and time-only fields. Calendar and DatePicker share one date engine.

WCAG 2.1 AA — release blocker

DatePicker must satisfy these on every render before it ships.

Web (React DOM)

  • Trigger is a standard <button> with aria-haspopup="dialog" and aria-expanded.
  • Calendar popup is rendered with Popover and the shared Calendar DayPicker v10 grid.
  • Selected date receives aria-selected="true" in the calendar grid.
  • Disabled dates are marked aria-disabled="true".
  • The clear action (when isClearable) has an accessible label and does not toggle the popover.

Keyboard

KeyAction
TabMove focus to/from the trigger.
Enter / SpaceOpen the calendar from the trigger.
EscapeClose the calendar popup.
Arrow Left/RightMove focus by one day.
Arrow Up/DownMove focus by one week.
Page Up/DownGo to previous/next month.
Shift + Page Up/DownGo to previous/next year.
Home / EndGo to start/end of the week.

Time selection

When showTimeSelect is enabled, the native time input is keyboard-accessible and announces the selected time through the browser.

Portal mode

DatePicker uses the shared Popover layer. If a modal date picker is needed, compose Calendar inside Dialog or Sheet explicitly.

React Native

  • DatePicker is a Pressable stub on native. Use @react-native-community/datetimepicker for native date picking.

Dark mode

Calendar and DatePicker use component-level token classes. No react-datepicker CSS import is required.

Reduced motion

Calendar animations are minimal (CSS-based transitions of 150ms). No custom motion to manage.

Audit checklist

  • Trigger is keyboard-focusable
  • Enter/Space opens the calendar
  • Escape closes the calendar
  • Arrow keys navigate the calendar grid
  • Selected date announced with aria-selected
  • Disabled dates are aria-disabled
  • Clear action is labelled
  • Time input is keyboard-accessible when enabled
  • 4.5:1 contrast on all interactive elements