Event Calendar
NewMonth view for events: timed and all-day chips, multi-day events, +N more, keyboard navigation and a day agenda. Dots on phones.
Pick a day to see its events
Arrow keys move between days; Page Up and Page Down change month.
Installation
$ pnpm dlx shadcn@latest add @synccn/event-calendarFirst time in this project? Connect synccn with one command.
Usage
import { EventCalendar } from "@/components/ui/event-calendar";<EventCalendar events={events} onEventClick={open} />API reference
Generated from the component's TypeScript types, so it always matches the code.
EventCalendar
Month view for events: chips with times, multi-day events, "+N more", today, keyboard navigation between days and an agenda for the selected day. On phones, chips shrink to dots.
- eventsrequired
CalendarEvent[]—
- defaultMonth
DateMonth shown first (any day in it). Defaults to the current month.
- onMonthChange
(month: Date) => voidCalled when the person moves to another month, with its first day.
- onEventClick
(event: CalendarEvent) => voidCalled when an event is chosen.
- onDayClick
(day: string, events: CalendarEvent[]) => voidCalled when a day is chosen, with a "YYYY-MM-DD" key and its events.
- weekStartsOn
0 | 1Default
1First day of the week: 0 is Sunday, 1 is Monday.
- maxPerDay
numberDefault
2Events shown in a day before "+N more".
- timeZone
stringIANA time zone used to place events on days and format their times, e.g. "America/New_York". With it, events render on the server too; without it, they appear once the page loads in the browser's own time zone.
- agenda
booleanDefault
trueShows the selected day's events under the grid.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for CalendarDays, ChevronLeft, ChevronRight
Used by
Keyboard
- ←or→Previous or next day
- ↑or↓Same day last or next week
- Page UporPage DownSame day last or next month
- EnterorSpaceSelect the day and show its agenda
Accessibility
- Uses grid, row and gridcell roles; today has aria-current="date" and each day's label includes its event count.
- Pass timeZone to render events on the server; without it they appear after load in the browser's time zone, so pages never hydrate with mismatched times.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: columnheader, grid, gridcell, row
- ARIA attributes: aria-current, aria-label, aria-labelledby, aria-live, aria-selected
- Keys handled: ArrowUp, ArrowDown, ArrowLeft, ArrowRight, PageUp, PageDown, Enter, Space
- Shows a visible focus ring for keyboard users
- Announces changes to screen readers