Forms

DatePicker

A fully accessible date picker with year→month→day drill-down, calendar popup, input masking, and healthcare-specific features like age calculation. Click the month or year in the header to jump to year or month selection. Essential for patient registration, appointment scheduling, and coverage management.

Year → Month → Day drill-down

Open the calendar and click the month name or year in the header to zoom out to month or year view. Select a year to see months, then a month to see days. Perfect for dates of birth or any date far from today.

DatePicker in a Modal

Click the button to open a small modal containing a DatePicker. The modal uses scrollBehavior outside so the calendar popup is not clipped. The DatePicker has a hint; the footer reserves space so selecting a date (and showing age or replacing the hint) does not cause layout shift.

Date of Birth with Age

For patient registration forms. Shows calculated age and prevents future dates.

Appointment Scheduling

For scheduling future appointments. Prevents past dates and weekends.

Coverage Period

For insurance coverage dates with min/max constraints.

Date Formats

Support for different date formats based on locale or requirements.

Service Date

For healthcare claims and billing. Allows any date within reasonable range.

Sizes

Choose appropriate sizes based on form density.

Validation States

Shows error and success states for form validation.

Disabled & Read-only

Use disabled for unavailable fields and read-only for view-only data.

Props

PropTypeDefaultDescription
label *stringInput label text
value string''ISO date string (YYYY-MM-DD) - bindable
format 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD''MM/DD/YYYY'Display format for the date
placeholder stringPlaceholder text (defaults to format)
required booleanfalseMarks field as required
disabled booleanfalseDisables the input
readonly booleanfalseMakes input read-only
error stringError message to display
hint stringHelper text shown on focus
successMessage stringSuccess message when valid
size 'sm' | 'md' | 'lg''md'Input size
showAge booleanfalseShow age calculation (for DOB)
minDate DateMinimum selectable date
maxDate DateMaximum selectable date
disablePast booleanfalseDisable dates in the past
disableFuture booleanfalseDisable dates in the future
isDateDisabled (date: Date) => booleanCustom function to disable specific dates
clearable booleanfalseShow clear button
validateOnMount booleanfalseShow validation state immediately
onchange (value: string, date: Date | null) => voidCalled when value changes
onopen () => voidCalled when calendar opens
onclose () => voidCalled when calendar closes
onclear () => voidCalled when clear button is clicked
alwaysShowFooter booleanfalseWhen true, the message footer (hint/error/success/age) is always rendered with reserved space to prevent layout shift when content appears (e.g. age on select, hint on focus). Use when hint or validation is set dynamically.

Drill-down & keyboard

Click: In the calendar header, click the month name to open the month grid, or the year to open the year grid. Select a year → then a month → then a day. Escape goes back (year → month → day → close).

KeyAction
Alt + ↓Open calendar
EscapeBack (year→month→day) or close calendar
← → ↑ ↓Navigate days, months, or years (depending on view)
Home / EndFirst/last day of month (day view)
Page Up/DownPrev/next month (day view) or prev/next year (month view) or prev/next year range (year view)
Shift + Page Up/DownPrev/next year (day view)
Enter / SpaceSelect focused day, month, or year

Message footer & layout shift

The message footer (hint, error, success, age) is shown in a reserved area below the input. To avoid layout shift when content appears or changes (e.g. hint on focus, age when a date is selected), the footer is rendered whenever the component can show any of that content—even if nothing is visible yet. When there is nothing to display, an invisible placeholder reserves one line of space.

  • Default: Footer is shown when the component has a hint, error, successMessage, or showAge. Footer is hidden only when none of these are set.
  • alwaysShowFooter: Set to true to always reserve footer space (e.g. when your app sets hint or error dynamically).

Healthcare Best Practices

  • • Use showAge for Date of Birth fields - critical for patient identification and dosing
  • • Use disableFuture for DOB and service dates to prevent data entry errors
  • • Use disablePast for appointment scheduling to only allow future dates
  • • Use minDate/maxDate for coverage periods to enforce valid date ranges
  • • Use isDateDisabled to block weekends, holidays, or unavailable dates
  • • Always provide clear labels that describe the clinical purpose
  • • Use clearable for optional date fields to allow easy reset

Accessibility Features

  • WAI-ARIA Dialog Pattern: Calendar popup follows W3C APG date picker dialog pattern
  • Year → Month → Day drill-down: Click month or year in header to jump; Escape steps back
  • Full Keyboard Navigation: Arrow keys in day, month, and year views; Home/End, PageUp/PageDown, Enter/Space/Escape
  • Focus Trap: Tab key cycles within calendar when open
  • Focus Restoration: Focus returns to trigger button when calendar closes; focus moves to first item when switching views
  • Live Announcements: Month/year changes and view changes announced to screen readers
  • ARIA Grid: Day calendar and month/year grids use appropriate roles and labels
  • Accessible Labels: Each day/month/year control has a clear label for screen readers
  • Reduced Motion: Respects prefers-reduced-motion for view transitions

Value Format

The value prop always uses ISO 8601 format (YYYY-MM-DD) regardless of the display format. This ensures consistent data storage and makes it easy to work with Date objects and APIs. The format prop only affects how the date is displayed to users.