Events data
Event data shapes and callback payloads for @mantine/schedule
Docs
Package
Overview
All @mantine/schedule components accept events through the events prop. Each event
is typed as ScheduleEventData and can be 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 variants share a common set of base fields described in ScheduleEventBase.
ScheduleEventBase
ScheduleEventBase defines the fields that every event has, regardless of its shape.
start and end accept either a Date instance or a string in YYYY-MM-DD HH:mm:ss
format (the DateTimeStringValue type used by all Mantine date components).
ScheduleSingleEventData
A one-off event without recurrence. This is the most common shape:
ScheduleRecurringSeriesEventData
A source event for a recurring series. Adds a recurrence field with an RFC 5545
recurrence rule:
The recurrence object has the following shape:
See the Recurring events guide for more details on recurrence rules and series expansion.
ScheduleRecurringOverrideEventData
An override event replaces a single generated occurrence from 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 arbitrary data to events. The payload is not used
internally by the library – it is meant for application-specific data that you can
access in callbacks (onEventClick, onEventDrop, etc.) and in custom event renderers
(renderEventBody):
EventPayload itself is just Record<PropertyKey, any> – you typically pass your own
payload type as a generic argument to ScheduleEventData<MyPayload>.
Recurring instance metadata
When a recurring series is expanded for the visible date range, each generated event
includes a recurringInstance metadata object. This object is added by the library –
you do not set it yourself, but you can read it in callbacks and custom renderers to
distinguish generated occurrences from regular events:
Example of reading the metadata in onEventClick:
Callback payloads
All event callbacks accept structured data describing what the user interacted with. The following sections document the exact payload received by each callback.
onEventClick
Called when an event is clicked in any view:
event– the clicked event, includingrecurringInstancemetadata if it is a generated occurrence.e– the native React mouse event.
onEventDrop
Called when an event is dropped after a drag (requires withEventsDragAndDrop):
eventId– id of the dropped event (same asevent.id). For generated recurring instances this is the synthesized occurrence id ("<seriesId>::<recurrenceId>"), not the series id. Useevent.recurringInstance?.recurringEventIdto get the parent series id when handling occurrences.newStart/newEnd– new datetime values inYYYY-MM-DD HH:mm:ssformat.event– full event data, includingrecurringInstancemetadata if applicable.
onEventResize
Called when an event is resized by dragging its top or bottom edge
(requires withEventResize):
The payload has the same shape as onEventDrop, including the caveat about eventId
for generated recurring instances.
onEventDragStart / onEventDragEnd
Called when an event drag starts or ends:
onEventDragEnd is called both for successful drops and for cancelled drags – use
onEventDrop if you need the new position.
onTimeSlotClick
Called when a time slot is clicked in DayView or WeekView:
slotStart/slotEnd– the slot range inYYYY-MM-DD HH:mm:ssformat. Slot length is controlled by the view'sintervalMinutesprop.
onAllDaySlotClick
Called when the all-day slot is clicked in DayView or WeekView:
date– the clicked date inYYYY-MM-DDformat.
onDayClick
Called when a day is clicked in MonthView or YearView:
date– the clicked date inYYYY-MM-DDformat.
onSlotDragEnd
Called when a slot range is selected by dragging across time slots or day cells
(requires withDragSlotSelect):
rangeStart/rangeEnd– the selected range inYYYY-MM-DD HH:mm:ssformat.
onExternalEventDrop
Called when an item is dragged from outside the schedule and dropped onto a slot:
dataTransfer– the nativeDataTransferobject set by the external item during itsonDragStarthandler. Read your custom data withdataTransfer.getData(type).dropDateTime– the drop target datetime inYYYY-MM-DD HH:mm:ssformat.
canDragEvent / canResizeEvent
Permission callbacks – return false to prevent dragging or resizing for a specific event:
Date and time value formats
Event data and callback payloads use the following string formats consistently:
DateStringValue–YYYY-MM-DD(e.g.2024-01-15)DateTimeStringValue–YYYY-MM-DD HH:mm:ss(e.g.2024-01-15 10:00:00)
These types are shared across @mantine/dates and @mantine/schedule and are exported
from both packages.