Usage
@prepared911/ui-calendar exports three building blocks that DatePicker composes internally and that you can reuse when a custom calendar layout is genuinely needed:
SelectMonth: a Select over the locale's month names, with optional minDate / maxDate clamping.SelectYear: a Select over a year range (default: 2020–currentYear).MonthCaption: the chevron + month / year Select header used by DatePicker.They sit in the components/ subpath of the package and are surfaced at the top level via the shared index. Reach for them only when you are building a react-day-picker surface that DatePicker can't express—e.g. a multi-month grid or a non-standard caption layout. In most cases, the answer is to use DatePicker directly.
DatePicker does not offer.MonthCaption inside a standard DatePicker. If the existing caption layout meets the need, use it: maintenance cost rises every time DatePicker changes upstream.<select> dropdowns. These components are tuned for month / year selection with calendar constraints. For generic dropdowns, use @prepared911/ui-core Select directly.SelectMonth. Pass selectedYear along with minDate / maxDate so months outside the range are disabled. Without maxDate, future months in the current year are auto-disabled.SelectYear. Override minYear / maxYear for surfaces with different historical ranges (e.g. a five-year analytics window).MonthCaption. Supports hideMonthYearSelect to fall back to chevron-only navigation and minSelectableDate / maxSelectableDate for fully constrained layouts.Do
minSelectableDate / maxSelectableDate aligned across MonthCaption, SelectMonth, and SelectYear so the grid, the month Select, and the year Select never present empty option sets.DatePicker for day-level selection and reach for these primitives only when the surface genuinely needs a custom layout.getMonthNamesFull() (which these components already use): don't hardcode a month array.Don't
MonthCaption inside a standard DatePicker: use DatePicker's caption directly unless design requires a divergent layout.Select with raw strings; SelectMonth / SelectYear already localize and clamp correctly.All three primitives render @prepared911/ui-core Selects or IconButtons that expose the current value to assistive technology. When you compose them into a custom DayPicker, follow react-day-picker's caption guidance so screen readers announce month and year changes predictably. See the Accessibility page for the full contract.