Scheduling
EventCalendar
Month, week, day, agenda and resource timeline views of your events, with repeating and multi-day events, where creating, moving and resizing an event works from the keyboard as well as with the pointer. Time zones are explicit, so an event moved a day later keeps its time across a daylight-saving change.
import '@reactloom/scheduler/styles.css';
import { EventCalendar } from '@reactloom/scheduler';Examples
Team schedule
Tab into the grid and use the arrow keys. Enter on an empty day or time adds an event; Enter on a cell with events moves into them; Alt + arrows move the focused event. Or drag an event.
import { EventCalendar, type CalendarEvent } from '@reactloom/scheduler';
import { useState } from 'react';
// Fixed dates keep the prerendered page and the live example identical.
const at = (day: number, hour: number, minute = 0) => new Date(Date.UTC(2031, 2, day, hour, minute));
const initial: CalendarEvent[] = [
{ id: 'standup', title: 'Team stand-up', start: at(12, 9), end: at(12, 9, 15) },
{ id: 'review', title: 'Quarterly business review', start: at(11, 13), end: at(11, 15) },
{ id: 'design', title: 'Design critique', start: at(12, 10), end: at(12, 11, 30) },
{ id: 'interview', title: 'Interview: frontend engineer', start: at(12, 10, 30), end: at(12, 11, 30) },
{ id: 'billing', title: 'Billing run', start: at(12, 0), end: at(13, 0), allDay: true },
{ id: 'lunch', title: 'Customer lunch', start: at(13, 12), end: at(13, 13, 30) },
{ id: 'offsite', title: 'Engineering offsite', start: at(18, 0), end: at(20, 0), allDay: true },
{ id: 'release', title: 'Release 2.4', start: at(14, 16), end: at(14, 17) },
];
export default function Example() {
const [events, setEvents] = useState(initial);
return (
<div style={{ width: '100%' }}>
<EventCalendar
aria-label="Team calendar"
events={events}
defaultDate={at(12, 9)}
timeZone="UTC"
height={460}
// Your app would open a form here; the demo adds a placeholder event.
onCreate={({ start, end, allDay }) => setEvents((list) => [...list, { id: `new-${list.length}`, title: 'New event', start, end, allDay }])}
onEventChange={({ event, start, end }) => setEvents((list) => list.map((e) => (e.id === event.id ? { ...e, start, end } : e)))}
/>
</div>
);
}Rooms: timeline, resources and repeating events
A row per room in the timeline and a column per room in the day view. Alt + ↑ / ↓ in the timeline (or ← / → in the day view) move a booking to another room; Alt + Shift + arrows change its end; drag the edge of an event to resize it.
import { EventCalendar, type CalendarEvent } from '@reactloom/scheduler';
import { useState } from 'react';
const at = (day: number, hour: number, minute = 0) => new Date(Date.UTC(2031, 2, day, hour, minute));
const rooms = [
{ id: 'a', title: 'Room A' },
{ id: 'b', title: 'Room B' },
{ id: 'studio', title: 'Studio' },
];
const initial: CalendarEvent[] = [
// Repeats every weekday (an RRULE can be read with parseRRule('FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR')).
{ id: 'standup', title: 'Stand-up', start: at(10, 9), end: at(10, 9, 15), resourceId: 'a', recurrence: { frequency: 'weekly', weekdays: ['MO', 'TU', 'WE', 'TH', 'FR'] } },
{ id: 'workshop', title: 'Design workshop', start: at(12, 10), end: at(12, 12), resourceId: 'b' },
{ id: 'podcast', title: 'Podcast recording', start: at(12, 13), end: at(12, 15), resourceId: 'studio' },
{ id: 'training', title: 'Onboarding training', start: at(11, 0), end: at(14, 0), allDay: true, resourceId: 'b' },
{ id: 'shoot', title: 'Product shoot', start: at(13, 9), end: at(15, 18), resourceId: 'studio' },
];
// Day view has a column per room; timeline a row per room. Alt + arrows move between rooms or
// days; Alt + Shift + arrows change the end. A moved occurrence reports its occurrenceStart.
export default function Example() {
const [events, setEvents] = useState(initial);
return (
<div style={{ width: '100%' }}>
<EventCalendar
aria-label="Room bookings"
events={events}
resources={rooms}
views={['timeline', 'day', 'month']}
defaultView="timeline"
defaultDate={at(12, 9)}
timeZone="UTC"
height={420}
onEventChange={({ event, start, end, resourceId, occurrenceStart }) =>
setEvents((list) =>
occurrenceStart
? // One occurrence of a series: keep the series, add the moved occurrence as its own event.
[
...list.map((e) => (e.id === event.id && e.recurrence ? { ...e, recurrence: { ...e.recurrence, exceptions: [...(e.recurrence.exceptions ?? []), occurrenceStart] } } : e)),
{ id: `${event.id}-${occurrenceStart.toISOString()}`, title: event.title, start, end, resourceId },
]
: list.map((e) => (e.id === event.id ? { ...e, start, end, resourceId } : e)),
)
}
/>
</div>
);
}Agenda first
A list of days and events: the clearest view for long ranges and for screen-reader users.
Monday, March 10, 2031
Tuesday, March 11, 2031
Wednesday, March 12, 2031
Monday, March 17, 2031
import { EventCalendar, type CalendarEvent } from '@reactloom/scheduler';
const at = (day: number, hour: number, minute = 0) => new Date(Date.UTC(2031, 2, day, hour, minute));
const shifts: CalendarEvent[] = [
{ id: 'a', title: 'Support rota: Priya', start: at(10, 8), end: at(10, 16) },
{ id: 'b', title: 'Support rota: Tomás', start: at(11, 8), end: at(11, 16) },
{ id: 'c', title: 'Maintenance window', start: at(12, 22), end: at(12, 23, 30) },
{ id: 'd', title: 'Public holiday', start: at(17, 0), end: at(18, 0), allDay: true },
];
export default function Example() {
return (
<div style={{ width: '100%' }}>
<EventCalendar aria-label="Support rota" events={shifts} defaultView="agenda" views={['agenda', 'week']} defaultDate={at(10, 8)} timeZone="UTC" agendaDays={10} />
</div>
);
}Your data, your rules
The calendar never changes your events. It reports what the person asked for — onCreate with a range, onEventChange with a new start and end — and shows whatever events you pass next. That keeps validation, conflicts, permissions and saving in your app.
<EventCalendar
events={events}
timeZone={user.timeZone} // e.g. 'Europe/Berlin'
onCreate={(range) => openNewEventDialog(range)}
onEventChange={async ({ event, start, end }) => {
setEvents((list) => list.map((e) => (e.id === event.id ? { ...e, start, end } : e))); // optimistic
try {
await api.moveEvent(event.id, { start, end });
} catch {
setEvents((list) => list.map((e) => (e.id === event.id ? event : e))); // roll back
toast.error('Could not move the event.');
}
}}
onEventSelect={(event) => openEvent(event.id)}
/>API reference
| Prop | Type | Default |
|---|---|---|
eventsrequiredEnd is exclusive; all-day events run midnight to midnight in timeZone. recurrence: { frequency, interval?, weekdays?, count?, until?, exceptions? } (parseRRule reads iCalendar rules). | { id, title, start: Date, end: Date, allDay?, color?, recurrence?, resourceId? }[] | — |
view / defaultView / onViewChange | 'month' | 'week' | 'day' | 'agenda' | 'timeline' | 'month' |
resourcesA column each in day view and a row each in timeline view. | { id, title }[] | — |
timelineDaysDays in timeline view (7 starts on the locale's first day of the week). | number | 7 |
viewsViews in the switcher. | CalendarView[] | — |
date / defaultDate / onDateChangeA day in the visible range. Default: today. | Date | — |
timeZoneIANA time zone for display and calculations. Default: the browser's. | string | — |
onCreateEnter on an empty day or slot, or a double-click. | ({ start, end, allDay }) => void | — |
onEventChangekind 'move' (Alt + arrows, drag) or 'resize' (Alt + Shift + arrows, dragging an edge). For one occurrence of a repeating event, event is the series and occurrenceStart says which one. | ({ event, start, end, allDay, kind, resourceId?, occurrenceStart? }) => void | — |
onEventSelectEnter, Space or click on an event. | (event) => void | — |
slotMinutesRows in week and day views. | 15 | 30 | 60 | 30 |
dayStartHour · dayEndHour · scrollToHour | number | 0 · 24 · 8 |
heightScroll area of week and day views. | number | string | 560 |
agendaDays | number | 14 |
headingLevelThe range title's heading. | 2 | 3 | 4 | 2 |
renderEventCustom event content. | (event) => ReactNode | — |
messagesTranslate every built-in string. | Partial<SchedulerMessages> | — |
Customization
Events use their color or the theme's chart colours in order; everything else uses ReactLoom tokens.
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-all-day] | present when on |
[data-axis] | present when on |
[data-compact] | present when on |
[data-continues-after] | present when on |
[data-continues-before] | present when on |
[data-dragging] | present when on |
[data-drop-target] | present when on |
[data-hour] | present when on |
[data-outside] | present when on |
[data-recurring] | present when on |
[data-today] | present when on |
Theme tokens it reads
--pl-color-accent-fg --pl-color-accent-solid --pl-color-bg-subtle --pl-color-bg-surface --pl-color-border-default --pl-color-border-subtle --pl-color-fg-default --pl-color-fg-muted --pl-color-fg-on-accent --pl-focus-ring-color --pl-focus-ring-width --pl-font-size-lg --pl-font-size-sm --pl-font-size-xs --pl-radius-md --pl-radius-xs
Accessibility
- Month, week and day views are WAI-ARIA grids with one tab stop. Each cell is named by its date (and time) and how many events it has; each event by its title, time and date.
- Everything a pointer can do, the keyboard can: adding an event, opening it, and moving it. Moves are announced politely and focus stays on the event, even when it moves to another week.
- Arrow keys follow the reading direction in right-to-left layouts.
- Repeating events say “repeats” in their name; multi-day events give their first and last day, and appear in every day they cover so each cell reads completely.
- Resource cells are named by the resource and the date or time; resizing announces the new end.
- The agenda view is an ordinary list — offer it for long ranges and as the default for people who prefer lists.
- Today is highlighted after the page loads, so server and browser render the same markup.
| Key | Action |
|---|---|
| ← → ↑ ↓ | Move between days (month) or days and time slots (week, day) |
| Home / End | First / last day of the week |
| Page Up / Page Down | Previous / next month (month) or week |
| Enter (empty cell) | Add an event there |
| Enter or F2 (cell with events) | Move into its events; ↑ ↓ between them |
| Alt + ← / → | Move the focused event a day earlier / later |
| Alt + ↑ / ↓ | Move it a week (month), a time slot (week, day) or to the next resource (timeline) |
| Alt + ← / → (day view with resources) | Move it to the neighbouring resource |
| Alt + Shift + ↑ / ↓ | End a time slot earlier / later (week, day) |
| Alt + Shift + ← / → | End a day earlier / later (month, timeline) |
| Escape | Back to the cell |
Usage guidelines
Do
- Pass the user's time zone explicitly when your server stores UTC.
- Confirm moves that affect other people (invitees, bookings) in your onEventChange.
Don’t
- Don't make dragging the only way to reschedule in your own custom views.