Overview
All @mantine/schedule components accept events through the events prop.
An event is one of three shapes:
- One-off event – a regular event without recurrence
- Recurring series event – a source event that expands into multiple occurrences
- Recurring override event – an event that replaces a single occurrence of a series
All three shapes share the base fields described below.
ScheduleEventBase
start and end accept a Date instance or a string in YYYY-MM-DD HH:mm:ss format.
ScheduleSingleEventData
A regular event without recurrence, the most common shape:
ScheduleRecurringSeriesEventData
A source event of a recurring series. It has a recurrence field with an RFC 5545
recurrence rule:
The recurrence object has the following shape:
See recurring events guide for rule examples and expansion details.
ScheduleRecurringOverrideEventData
An override event replaces a single generated occurrence of a series:
recurringEventId– id of the parent series eventrecurrenceId– original occurrence datetime inYYYY-MM-DD HH:mm:ssformat
EventPayload
Use the payload field to attach your own data to events. The library does not read it,
it is available in callbacks and custom event renderers:
Pass your payload type as a generic argument to get typed access: ScheduleEventData<MyPayload>.
Recurring instance metadata
Each event generated from a recurring series has a recurringInstance object.
Read it in callbacks and custom renderers to tell generated occurrences from regular events:
Example of reading the metadata in onEventClick:
Callback payloads
onEventClick
Called when an event is clicked in any view:
onEventDrop
Called when an event is dropped after a drag (requires withEventsDragAndDrop):
For generated recurring occurrences, eventId is the occurrence id, not the series id.
Use event.recurringInstance?.recurringEventId to get the series id.
onEventResize
Called when an event is resized by dragging its top or bottom edge
(requires withEventResize):
The payload has the same shape as in onEventDrop, including the eventId note
for generated recurring occurrences.
onEventDragStart / onEventDragEnd
Called when an event drag starts or ends:
onEventDragEnd is called for both successful drops and cancelled drags.
Use onEventDrop to get the new position.
onTimeSlotClick
Called when a time slot is clicked in DayView or WeekView:
Slot length is controlled by the view's intervalMinutes prop.
onAllDaySlotClick
Called when the all-day slot is clicked in DayView or WeekView:
onDayClick
Called when a day is clicked in MonthView or YearView:
onSlotDragEnd
Called when a slot range is selected by dragging across time slots or day cells
(requires withDragSlotSelect):
onExternalEventDrop
Called when an item is dragged from outside the schedule and dropped onto a slot:
dataTransfer is the native object set by the external item in its onDragStart handler.
Read your data with dataTransfer.getData(type).
Callbacks in resources views
In resources views, onDayClick, onSlotDragEnd and onExternalEventDrop are called with
a single object that includes resourceId of the row. onTimeSlotClick payload includes resourceId as well:
canDragEvent / canResizeEvent
Return false to prevent dragging or resizing of a specific event:
preventEventOverlap
Rejects drops and resizes that would make the event overlap another event, see drop validation for what counts as a conflict:
Pass a function to decide per pair of events, return true to forbid the overlap.
movingEvent has the new start and end and, in resources views, the target resourceId.
The function is called many times while dragging, it must be pure and cheap.
canDropEvent / canResizeEventTo / canDropExternalEvent
Return false to reject a drop or resize based on where the event is being placed.
The callbacks are called many times while dragging, they must be pure and cheap:
canDropExternalEvent has no end, the schedule does not know the duration of an external item.
Only dataTransfer.types can be read while the drag is in progress.
onEventPlacementRejected
Called when a drop, resize or external drop is rejected by preventEventOverlap or by one of
the placement callbacks above. The payload shape depends on action:
conflicts– events the placement collided with, empty when the rejection came from a callbackreason–'overlap'whenpreventEventOverlapfound a conflict,'rejected'when a callback returnedfalseresourceId– only in resources views: the target resource for drops, the event's own resource forresize
Date and time value formats
Event data and callback payloads use two string formats:
DateStringValue–YYYY-MM-DD, for example2024-01-15DateTimeStringValue–YYYY-MM-DD HH:mm:ss, for example2024-01-15 10:00:00
Both types are exported from @mantine/dates and @mantine/schedule.