Event Timeline - Drag Interaction
Re-schedule or resize your events using drag and drop.
Events can be moved to a different time slot by dragging them, and resized by dragging their start or end edge. Both behaviors are enabled by default:
Disable event dragging
Use the areEventsDraggable property to prevent dragging events to another point in time:
<EventTimelinePremium areEventsDraggable={false} />
Disable event resizing
Use the areEventsResizable property to prevent resizing events by dragging their start or end edge:
<EventTimelinePremium areEventsResizable={false} />
Only disable on some events
Per event
Use the draggable property on the event model to prevent an event from being dragged to another point in time:
const event = {
// ...other properties
draggable: false,
};
Use the resizable property on the event model to prevent an event from being resized by dragging its start or end edge:
const event = {
// ...other properties
resizable: false,
};
Per resource
Use the areEventsDraggable property on the resource model to prevent dragging a resource's events to another point in time:
const resource = {
// ...other properties
areEventsDraggable: false,
};
Use the areEventsResizable property on the resource model to prevent resizing a resource's events by dragging their start or end edge:
const resource = {
// ...other properties
areEventsResizable: false,
};
Priority order
The priority order for determining if an event is draggable or resizable is:
- The
draggableandresizableproperties assigned to the event
<EventTimelinePremium
events={[{ id: '1', title: 'Event 1', draggable: false, resizable: false }]}
/>
- The
areEventsDraggableandareEventsResizableproperties assigned to the event's resource
<EventTimelinePremium
resources={[
{
id: '1',
title: 'Resource 1',
areEventsDraggable: false,
areEventsResizable: false,
},
]}
/>
- The
areEventsDraggableandareEventsResizableprops assigned to the Event Timeline
<EventTimelinePremium areEventsDraggable={false} areEventsResizable={false} />
For example, with the following code, all "work" events are not draggable except "event-3":
function App() {
const resources = [
{ id: 'work', title: 'Work', areEventsDraggable: false },
{ id: 'personal', title: 'Personal' },
];
const events = [
{ id: 'event-1', resource: 'work' },
{ id: 'event-2', resource: 'personal' },
{ id: 'event-3', resource: 'work', draggable: true },
];
return <EventTimelinePremium resources={resources} events={events} />;
}
External drag and drop
You can enable the dragging from and to the outside of the Event Timeline using the canDragEventsFromTheOutside and canDropEventsToTheOutside props.
When canDragEventsFromTheOutside is true, the events created with <StandaloneEvent /> can be dropped inside the Event Timeline.
When canDropEventsToTheOutside is true, the events from within the Event Timeline can be dropped outside of it.