What it does
The date picker composes the popover and calendar components into an input-like control. Single mode closes on pick; range mode stays open until the end date is set. The selected value renders as locale-formatted text on the trigger, with an optional clear affordance.
The calendar day matcher is exposed as disabledDates, while the picker's own disabled prop is the standard whole-control boolean.
Composition and API
Value and open state are both controllable. Calendar options — locale, firstDayOfWeek, min/max bounds, numberOfMonths, caption dropdowns — thread straight through, and the picker's appearance colors both the trigger and the embedded calendar so they always match. The animated entry adds framer-motion month transitions inside the popover.
Common use cases
- Booking and reservation forms with check-in/check-out ranges.
- Deadline and due-date fields in dashboards and task managers.
- Birthday fields using the dropdown caption for fast year jumps.
- Report filters where a formatted range reads back at a glance.
Accessibility
The trigger sets aria-haspopup="dialog" and aria-expanded; the popover is a labeled dialog containing the ARIA-grid calendar. Focus moves into the grid on open and returns to the trigger on close.
This preview page exposes a single h1 in the hero for a clean outline.
Next.js integration notes
Keep the picker in a client component and pass explicit today and locale props in SSR-critical paths for deterministic markup.
Set NEXT_PUBLIC_SITE_URL so canonical and Open Graph URLs resolve on deploy.
FAQ
Does the Date Picker component work with plain HTML forms?
Yes. Pass a name prop and it renders hidden inputs with local-date yyyy-MM-dd values (name and name-end for ranges), built with local getters so values never shift across timezones.
How is the trigger text formatted?
Through Intl.DateTimeFormat with your formatOptions (default { dateStyle: "medium" }). Complete ranges use formatRange when the runtime supports it, with a join fallback.
Is the Date Picker keyboard accessible?
Yes. The trigger opens with click or ArrowDown, focus moves into the calendar grid, Escape closes and returns focus to the trigger, and the embedded calendar implements the full ARIA grid keyboard pattern.