MonthPicker

A grid of months to pick one, with a year header. Use it for billing periods, reports and any date where the day does not matter.

General

Click a month, or move with the arrow keys. onChange receives a Date on the first day of the month.

Controlled

Pass value and update it in onChange.

Min and max

Months outside min and max are disabled, and so are the year buttons that would lead only to them.

Locale

Month names come from Intl. Set locale and the button labels.

APIs

MonthPicker.Props

AttributeDescriptionTypeAccepted valuesDefault
valueselected month, to control the componentDate | null--
initialValueselected month at the startDate | null-null
onChangecalled with the first day of the chosen month(month: Date) => void--
minfirst month that can be pickedDate--
maxlast month that can be pickedDate--
localelanguage of the month namesstring-en-US
autoFocusfocus the month on mountboolean-false
previousLabelname of the previous year buttonstring-Previous year
nextLabelname of the next year buttonstring-Next year
...native props, passed to the rootHTMLAttributes'id', 'className', ...-

Ref

The ref points at the root div.

Accessibility

The months are buttons inside a group named by the year. Each one has the full name, such as "November 2026", and aria-pressed tells which is selected. Only the focused month is in the tab order.

KeyAction
Arrow Left and RightPrevious and next month, across years
Arrow Up and DownThree months back and forward
Home and EndFirst and last month of the year
Page Up and DownSame month of the previous and next year
Enter and SpacePick the focused month
Edit this page on GitHub