Skip to main content

Month Navigator

StorybookView in Storybook

Explore interactive examples and all component variations in our Storybook.

The MonthNavigator component provides an intuitive interface for navigating between months and years. Built with accessibility in mind, it offers both month-by-month and year-by-year navigation modes. Perfect for calendar interfaces, date pickers, scheduling applications, and any interface that requires temporal navigation.

Basic Usage

January

2026

Year Navigation Mode

Calendar Integration

Calendar

January

2026

Sun
Mon
Tue
Wed
Thu
Fri
Sat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Date Range Selection

Date Range Selector

January

2026

February

2026

Selected Range:

From January 2026 to February 2026

Localization Support

English (Default)

January

2026

💡 The MonthNavigator supports all date-fns locales. Import your desired locale and pass it to the locale prop for internationalization.

Different Navigation Modes

Month Navigation

Navigate month by month with year display

January

2026

Mode: month | Wraps to next/previous year

Year Navigation

Navigate year by year, month stays constant

2026

Mode: year | Only changes year value

Properties

MonthNavigator

PropertyTypeDefaultDescription
currentMonthMonth-The currently selected month (0-11).
currentYearnumber-The currently selected year.
onChangeMonthYear(month: Month, year: number) => void-Callback fired when the month or year changes.
mode'month' | 'year''month'Navigation mode - month-by-month or year-by-year.
localeLocaleenUSDate-fns locale for internationalization.

Month Type

type Month = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11

Represents months as zero-indexed numbers (0 = January, 11 = December).

Month Mode

  • Previous: Decrements month, wraps to December of previous year when at January
  • Next: Increments month, wraps to January of next year when at December
  • Display: Shows full month name and year

Year Mode

  • Previous: Decrements year by 1, month stays constant
  • Next: Increments year by 1, month stays constant
  • Display: Shows only the year value

Accessibility

The MonthNavigator component includes comprehensive accessibility features:

  • Keyboard Navigation - Arrow keys and Enter/Space for button activation
  • Screen Reader Support - Proper ARIA labels describing navigation actions
  • Focus Management - Clear focus indicators on navigation buttons
  • Semantic HTML - Uses proper button elements with descriptive labels
  • High Contrast - Supports high contrast mode and custom themes
  • Reduced Motion - Respects user's motion preferences

Common Use Cases

The MonthNavigator component is perfect for:

  • Calendar Interfaces - Navigate between months in calendar views
  • Date Pickers - Provide month/year selection in date picker components
  • Scheduling Applications - Navigate time periods for appointments and events
  • Reporting Dashboards - Select time periods for data visualization
  • Content Archives - Browse content by month and year
  • Event Planning - Navigate dates for event scheduling
  • Financial Applications - Select periods for financial reports
  • Analytics Tools - Choose time ranges for data analysis

Best Practices

  1. State Management - Always use controlled state for month and year values
  2. Validation - Validate month/year combinations for your use case
  3. Localization - Use appropriate date-fns locale for your target audience
  4. Mode Selection - Choose the right navigation mode for your use case
  5. Visual Integration - Style the navigator to match your application's design
  6. Responsive Design - Ensure the navigator works well on mobile devices
  7. Accessibility - Test with screen readers and keyboard navigation
  8. Performance - Memoize callback functions to prevent unnecessary re-renders