Skip to Content
PluginsDrag & Drop

Drag & Drop Plugin

The Drag & Drop plugin enables interactive event management, allowing users to move, resize, and create events directly on the calendar grid.

Installation

Install the plugin using your preferred package manager:

npm install @dayflow/plugin-drag
import { createDragPlugin } from '@dayflow/plugin-drag';

Usage

import { useCalendarApp, ViewType } from '@dayflow/react'; // or '@dayflow/vue', '@dayflow/svelte', '@dayflow/angular' import { createDragPlugin } from '@dayflow/plugin-drag'; function MyCalendar() { const dragPlugin = createDragPlugin({ enableDrag: true, enableResize: true, enableCreate: true, onEventDrop: (updated, original) => { console.log('Event moved:', updated); }, onEventResize: (updated, original) => { console.log('Event resized:', updated); }, }); const calendar = useCalendarApp({ // ... views plugins: [dragPlugin], }); // ... }

Configuration

PropertyTypeDefaultDescription
enableDragbooleantrueAllow moving events by dragging.
enableResizebooleantrueAllow changing event duration by resizing.
enableCreatebooleantrueAllow creating events by double-clicking the grid.
enableAllDayCreatebooleantrueAllow creating all-day events by dragging in the all-day row.
supportedViewsViewType[][DAY, WEEK, MONTH, YEAR]Views where drag functionality should be enabled.
onEventDropFunction-Callback when an event is moved (drag-and-drop).
onEventResizeFunction-Callback when an event is resized.

Plugin API

You can access the drag service to update configuration dynamically:

const dragService = calendar.app.getPlugin<DragService>('drag'); // Disable resizing dynamically dragService.updateConfig({ enableResize: false });
Last updated on