Drag and Drop Between Calendars

There are certain cases when moving the events between calendars can come in handy.

Dragging and dropping events between two calendar instances can be enabled by turning on the externalDrag and externalDrop options.

Get started with this example

Demo

Loading the live demo

Preview in full screen

Drag and drop events between two side-by-side event calendar in month view — move events across separate calendars with cross-calendar drag and drop.

Code

import { Eventcalendar, setOptions, Toast  } from '@mobiscroll/react';
import { useCallback, useMemo, useState } from 'react';

setOptions({
  locale:  ,
  theme: ' ',
  themeVariant: ' '
});

function App() {
  const [toastText, setToastText] = useState();
  const [toastContext, setToastContext] = useState();
  const [isToastOpen, setToastOpen] = useState(false);

  const myView = useMemo(() => ({ calendar: { type: 'month' } }), []);

  const firstEvents = useMemo(
    () => [
      {
        start: '2026-10-18T00:00',
        end: '2026-10-20T00:00',
        title: 'Event 1',
        color: '#e20000',
      },
      {
        start: '2026-10-22T00:00',
        end: '2026-10-24T00:00',
        title: 'Event 2',
        color: '#166f6f',
      },
      {
        start: '2026-10-27T00:00',
        end: '2026-10-28T00:00',
        title: 'Event 3',
        color: '#166f6f',
      },
      {
        start: '2026-11-01T00:00',
        end: '2026-11-03T00:00',
        title: 'Event 4',
        color: '#a32f00',
      },
      {
        start: '2026-11-05T00:00',
        end: '2026-11-07T00:00',
        title: 'Event 5',
        color: '#8b8b00',
      },
      {
        start: '2026-11-11T00:00',
        end: '2026-11-13T00:00',
        title: 'Event 6',
        color: '#1dab2f',
      },
      {
        start: '2026-11-15T00:00',
        end: '2026-11-16T00:00',
        title: 'Event 7',
        color: '#4981d6',
      },
      {
        start: '2026-11-20T00:00',
        end: '2026-11-21T00:00',
        title: 'Event 8',
        color: '#4418d2',
      },
      {
        start: '2026-11-26T00:00',
        end: '2026-11-26T00:00',
        title: 'Event 9',
        color: '#6e7f29',
      },
      {
        start: '2026-12-03T00:00',
        end: '2026-12-04T00:00',
        title: 'Event 10',
        color: '#8b0000',
      },
      {
        start: '2026-12-09T00:00',
        end: '2026-12-10T00:00',
        title: 'Event 11',
        color: '#a32f00',
      },
      {
        start: '2026-12-14T00:00',
        end: '2026-12-16T00:00',
        title: 'Event 12',
        color: '#152d2b',
      },
    ],
    [],
  );

  const secondEvents = useMemo(
    () => [
      {
        start: '2026-10-20T00:00',
        end: '2026-10-20T00:00',
        title: 'Event 1',
        color: '#',
      },
      {
        start: '2026-10-24T00:00',
        end: '2026-10-26T00:00',
        title: 'Event 2',
        color: '#',
      },
      {
        start: '2026-10-28T00:00',
        end: '2026-10-28T00:00',
        title: 'Event 3',
        color: '#4418d2',
      },
      {
        start: '2026-11-02T00:00',
        end: '2026-11-02T00:00',
        title: 'Event 4',
        color: '#8b1a1a',
      },
      {
        start: '2026-11-06T00:00',
        end: '2026-11-07T00:00',
        title: 'Event 5',
        color: '#e7b300',
      },
      {
        start: '2026-11-12T00:00',
        end: '2026-11-13T00:00',
        title: 'Event 6',
        color: '#a32f00',
      },
      {
        start: '2026-11-17T00:00',
        end: '2026-11-19T00:00',
        title: 'Event 7',
        color: '#21a833',
      },
      {
        start: '2026-11-22T00:00',
        end: '2026-11-22T00:00',
        title: 'Event 8',
        color: '#a917bb',
      },
      {
        start: '2026-11-25T00:00',
        end: '2026-11-27T00:00',
        title: 'Event 9',
        color: '#e20000',
      },
      {
        start: '2026-12-01T00:00',
        end: '2026-12-02T00:00',
        title: 'Event 10',
        color: '#4981d6',
      },
      {
        start: '2026-12-04T00:00',
        end: '2026-12-04T00:00',
        title: 'Event 11',
        color: '#166f6f',
      },
      {
        start: '2026-12-08T00:00',
        end: '2026-12-10T00:00',
        title: 'Event 12',
        color: '#d6d145',
      },
    ],
    [],
  );

  const handlehandleCloseToast = useCallback(() => {
    setToastOpen(false);
  }, []);

  const handleFirstCalEventCreated = useCallback((args) => {
    if (args.action === 'externalDrop') {
      setToastText('Event dropped to Calendar 1');
      setToastContext('.md-drag-drop-first-calendar');
      setToastOpen(true);
    }
  }, []);

  const handleSecondCalEventCreated = useCallback((args) => {
    if (args.action === 'externalDrop') {
      setToastText('Event dropped to Calendar 2');
      setToastContext('.md-drag-drop-second-calendar');
      setToastOpen(true);
    }
  }, []);

  return (
    <div className="mbsc-grid mbsc-no-padding md-drag-drop-calendar">
      <div className="mbsc-row">
        <div className="mbsc-col-sm-6 md-drag-drop-calendar-border">
          <div className="mbsc-form-group-title">Calendar 1</div>
          <Eventcalendar
            view={myView}
            data={firstEvents}
            height={550}
            dragToMove={true}
            eventDelete={true}
            externalDrag={true}
            externalDrop={true}
            onEventCreated={handleFirstCalEventCreated}
            className="md-drag-drop-first-calendar"
          />
        </div>
        <div className="mbsc-col-sm-6">
          <div className="mbsc-form-group-title">Calendar 2</div>
          <Eventcalendar
            view={myView}
            data={secondEvents}
            height={550}
            dragToMove={true}
            eventDelete={true}
            externalDrag={true}
            externalDrop={true}
            onEventCreated={handleSecondCalEventCreated}
            className="md-drag-drop-second-calendar"
          />
        </div>
      </div>
      <Toast message={toastText} context={toastContext} isOpen={isToastOpen} onClose={handlehandleCloseToast} />
    </div>
  );
}

export default App;

Duplicate Session

You have signed in on a different machine. To keep everything in sync, you have been signed out of this session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.

Duplicate Session

We noticed you are logged in on a different machine and have closed your old session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.