Skip to main content

Caption and Navigation Layouts

Caption Layouts

Use the captionLayout prop to customize the layout of the month caption.

<DayPicker captionLayout="label" /> // Default value: shows the month and year.

Caption Dropdown

To enable a navigation dropdown, set captionLayout to dropdown, dropdown-months, or dropdown-years.

  • When displaying the dropdown for the years, use the reverseYears prop to reverse the order of the years.
  • Use the startMonth and endMonth properties to define the start and end dates for the calendar navigation.
Default Range

Without specifying the startMonth and endMonth properties, the dropdown will display the last 100 years.

<DayPicker
captionLayout="dropdown"
defaultMonth={new Date(2024, 6)}
startMonth={new Date(2024, 6)}
endMonth={new Date(2025, 9)}
/>

Use the navLayout prop to adjust the positioning of the navigation buttons.

<DayPicker navLayout="around" />
<DayPicker navLayout="after" />

See Navigation for additional ways to customize the calendar’s navigation.

Tab Order vs. Visual Order

If not set, the navigation buttons default to being displayed after the caption. However, the tab order may not align with the visual order when setting "dropdown" as caption layout. To ensure the component remains accessible, set navLayout to "after" or to "around" instead of leaving it undefined.

In a future version, the default behavior will be changed to "after".

Disabling the Navigation

To prevent the user from navigating between months, set the disableNavigation prop to true.

<DayPicker disableNavigation />

Hiding the Navigation

To hide the navigation completely, set the hideNavigation prop to true. This is useful when setting the caption layout to "dropdown".

<DayPicker hideNavigation captionLayout="dropdown" />