Overview
TheMonthlyCalendar component displays events in a traditional month grid view, similar to Google Calendar or Outlook. It automatically handles event overflow with popover lists, highlights the current day, and supports custom event rendering. Ideal for applications that need a high-level overview of monthly schedules.
Import
Basic Usage
Props
Array of events to display in the calendar. Events are automatically sorted by start time within each day.
Function to render each event in the calendar grid. This is used for the main event display.
The date to show in the calendar. Determines which month is displayed.
Callback fired when the date changes through month navigation controls.
Whether to show month navigation controls (previous/next arrows and Today button).
Custom header content to display above the calendar.
Optional alternative render function for events. When provided, this is used instead of
eventRenderer for rendering events in day cells.Whether the calendar is in a loading state. Shows placeholder UI when true.
Callback to run when the overflow events popover closes.
Additional class name for the calendar container element.
Event Data Structure
TheCalendarEvent interface defines the structure for calendar events:
Custom Event Rendering
Use theMonthlyCalendarEvent component for styled event items:
Event Overflow Handling
When a day has more events than can fit in the grid cell:Month Navigation
Complete Example
Grid Layout
The calendar grid:- Always shows complete weeks (42 or 35 days depending on the month)
- Includes dates from previous and next months to fill the grid
- Grays out dates outside the current month
- Highlights today’s date
- Starts weeks on Sunday
Custom Day Rendering
For advanced customization, userenderDayItem instead of eventRenderer:
When
renderDayItem is provided, it takes precedence over eventRenderer for the main calendar grid. The eventRenderer is still used in the overflow popover.Loading State
loading is true, the calendar displays placeholder elements in each day cell.
Multiple Events Per Day
Events are automatically sorted by start time within each day:Accessibility
- Semantic HTML structure with proper heading hierarchy
- ARIA labels describing the current month
- Keyboard navigation for month controls
- Screen reader support for date changes
- Focusable event items
Performance
Event Sorting
Event Sorting
Events are sorted once when passed to the component, not on every render. For optimal performance, memoize your events array.
Grid Calculation
Grid Calculation
The calendar calculates grid dates efficiently and only recalculates when the month changes.
Popover Rendering
Popover Rendering
Overflow popovers are rendered on-demand, not upfront, keeping the initial render fast.
TypeScript
The component supports generic typing for custom event data:Best Practices
Event Height
Event Height
Keep event heights consistent (around 40-50px) for the best visual layout. The calendar will show 3-4 events per cell before overflow.
Event Titles
Event Titles
Use concise event titles that fit within the narrow day cells. Long titles will be truncated.
Color Coding
Color Coding
Use consistent colors for event categories to help users quickly scan the calendar.
Responsive Design
Responsive Design
The calendar adapts to its container width. Ensure the container has adequate space (minimum 800px recommended).
Related Components
UnifiedCalendar
Combined monthly and weekly calendar with view switching
WeeklyCalendar
Time-slot based weekly calendar view