Skip to Content

Drag & Drop


Drag & Drop

React Scheduler Pro comes with built-in native drag-and-drop support. No external libraries required.

Enabling Drag & Drop

Drag and drop is enabled by default. You can control it with the draggable and resizable props.

<Scheduler
events={events}
fields={fields}
draggable={true}
resizable={true}
onEventDrop={handleEventDrop}
onEventResize={handleEventResize}
/>

Moving Events

Users can click and drag any event to move it to a different time slot, day, or resource.

const handleEventDrop = ({ event, start, end, resource, originalEvent }) => {
// Update your events state with the new times
setEvents((prev) =>
prev.map((e) =>
e._id === event._id ? { ...e, startDate: start, endDate: end } : e
)
);
};

Callback: onEventDrop

PropertyTypeDescription
eventobjectThe event that was dropped
startDateNew start time
endDateNew end time
resourceobject | undefinedThe target resource (if using resources)
originalEventobjectThe event before it was moved

Resizing Events

Users can drag the bottom edge of an event to change its duration. A resize handle appears when hovering near the bottom of an event.

const handleEventResize = ({ event, start, end, originalEvent }) => {
setEvents((prev) =>
prev.map((e) =>
e._id === event._id ? { ...e, startDate: start, endDate: end } : e
)
);
};

Callback: onEventResize

PropertyTypeDescription
eventobjectThe event that was resized
startDateStart time (unchanged)
endDateNew end time
originalEventobjectThe event before resize

Disabling Drag & Drop

// Disable both
<Scheduler draggable={false} resizable={false} />
// Disable only resize
<Scheduler draggable={true} resizable={false} />

Touch Support

Drag and drop works on touch devices out of the box. Long-press an event to start dragging on mobile.

Snap to Grid

Events snap to the nearest time interval based on your step prop. For example, with step={30}, events snap to 30-minute intervals.

© 2024 Released under the MIT license