---
title: "React Timeline Cross-Instance Drag and Drop Example | Mobiscroll"
component: "Timeline"
framework: "React"
library_version: "6.2.0"
url: "https://demo.mobiscroll.com/react/timeline/drag-drop-between-calendar-instances"
---

# Cross-Instance Drag and Drop - React Timeline demo

Drag and drop events between two React Timeline views to reassign resources or coordinate schedules — enable cross-timeline transfers. For React and Next.js.

- [Live demo](https://demo.mobiscroll.com/react/timeline/drag-drop-between-calendar-instances)
- [View React JS code on GitHub](https://github.com/acidb/mobiscroll-demos-react/tree/main/src/demos/eventcalendar/timeline/drag-drop-between-calendar-instances)
- [View React TS code on GitHub](https://github.com/acidb/mobiscroll-demos-react-ts/tree/main/src/demos/eventcalendar/timeline/drag-drop-between-calendar-instances)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/timeline/drag-drop-between-calendar-instances.md), [jQuery](https://demo.mobiscroll.com/jquery/timeline/drag-drop-between-calendar-instances.md), [Angular](https://demo.mobiscroll.com/angular/timeline/drag-drop-between-calendar-instances.md), [Vue](https://demo.mobiscroll.com/vue/timeline/drag-drop-between-calendar-instances.md)

## Description

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

Dragging and dropping events between two timeline instances can be enabled by turning on the [`externalDrag`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-externalDrag) and [`externalDrop`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-externalDrop) options.

**Want to learn about how you can configure the horizontal and vertical resolution?** [Check out how to build a synchronized flight scheduling dashboard →](https://demo.mobiscroll.com/react/timeline/flight-scheduling-two-synchronized-timelines)

## What this demo shows

- Two separate monthly timeline instances are displayed one below the other, where days are arranged horizontally and resources are listed as rows on the left.
- **Header navigation** The month and year label opens date navigation, while the previous and next arrows move between weeks and the Today button returns to the current date.
- **Month view** The strip below the header show days of the selected month, with the current date highlighted.
- **Resources** Multiple resources are shown as separate timeline rows.
- **Event cards** Events are shown as colored cards with a left color stripe, a bold title, and the start and end time of the event below the title.
- **External drag and drop** Events can be dragged from one timeline instance and dropped into the other to move them between the two timelines.
- **Date positioning** Events are positioned by their assigned resource and exact date range.
- **Event interaction** Events highlight on hover and show drag and resize handles for repositioning or changing duration.
- **Event selection** Clicking an event selects and highlights it.
- **Event creation** New events can be created by double-clicking the timeline or by clicking and dragging across a time range.
- **Scrolling** The timeline supports horizontal and vertical scrolling for navigating through time and resources.

## Best for

- **Multi-timeline planning** Moving events between separate team, department, or location calendars.
- **Resource reassignment** Reassigning appointments, tasks, or shifts from one timeline to another with direct drag and drop.
- **Parallel timeline review** Comparing two weekly timelines and adjusting event placement between them.

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-themeVariant) - option
- [`view`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-view) - option
- [`data`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-data) - option
- [`resources`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-resources) - option
- [`height`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-height) - option
- [`dragToMove`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-dragToMove) - option
- [`eventDelete`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-eventDelete) - option
- [`externalDrag`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-externalDrag) - option
- [`externalDrop`](https://mobiscroll.com/docs/react/eventcalendar/api#opt-externalDrop) - option
- [`onEventCreated`](https://mobiscroll.com/docs/react/eventcalendar/api#event-onEventCreated) - event
- [`onClose`](https://mobiscroll.com/docs/react/notifications/toast#event-onClose) - event

## Code

### JSX

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

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

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

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

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

  const firstResources = useMemo(
    () => [
      {
        id: 1,
        name: 'Resource A',
      },
      {
        id: 2,
        name: 'Resource B',
      },
      {
        id: 3,
        name: 'Resource C',
      },
      {
        id: 4,
        name: 'Resource D',
      },
      {
        id: 5,
        name: 'Resource E',
      },
    ],
    [],
  );

  const secondEvents = useMemo(
    () => [
      {
        start: '2026-11-05T00:00',
        end: '2026-11-09T00:00',
        title: 'Event 1',
        color: '#4418d2',
        resource: 1,
      },
      {
        start: '2026-11-16T00:00',
        end: '2026-11-20T00:00',
        title: 'Event 2',
        color: '#8b1a1a',
        resource: 1,
      },
      {
        start: '2026-11-08T00:00',
        end: '2026-11-11T00:00',
        title: 'Event 3',
        color: '#e7b300',
        resource: 2,
      },
      {
        start: '2026-11-22T00:00',
        end: '2026-11-25T00:00',
        title: 'Event 4',
        color: '#a32f00',
        resource: 2,
      },
      {
        start: '2026-11-12T00:00',
        end: '2026-11-17T00:00',
        title: 'Event 5',
        color: '#21a833',
        resource: 3,
      },
      {
        start: '2026-11-23T00:00',
        end: '2026-11-29T00:00',
        title: 'Event 6',
        color: '#a917bb',
        resource: 3,
      },
      {
        start: '2026-11-04T00:00',
        end: '2026-11-10T00:00',
        title: 'Event 7',
        color: '#e20000',
        resource: 4,
      },
      {
        start: '2026-11-18T00:00',
        end: '2026-11-25T00:00',
        title: 'Event 8',
        color: '#4981d6',
        resource: 4,
      },
      {
        start: '2026-11-07T00:00',
        end: '2026-11-12T00:00',
        title: 'Event 9',
        color: '#166f6f',
        resource: 5,
      },
      {
        start: '2026-11-20T00:00',
        end: '2026-11-27T00:00',
        title: 'Event 10',
        color: '#d6d145',
        resource: 5,
      },
    ],
    [],
  );

  const secondResources = useMemo(
    () => [
      {
        id: 1,
        name: 'Resource A',
      },
      {
        id: 2,
        name: 'Resource B',
      },
      {
        id: 3,
        name: 'Resource C',
      },
      {
        id: 4,
        name: 'Resource D',
      },
      {
        id: 5,
        name: 'Resource E',
      },
    ],
    [],
  );

  const handleCloseToast = 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="md-drag-drop-calendar">
      <div className="mbsc-form-group-title">Calendar 1</div>
      <Eventcalendar
        view={myView}
        data={firstEvents}
        resources={firstResources}
        height={420}
        dragToMove={true}
        eventDelete={true}
        externalDrag={true}
        externalDrop={true}
        onEventCreated={handleFirstCalEventCreated}
        className="md-drag-drop-first-calendar"
      />

      <div className="mbsc-form-group-title">Calendar 2</div>
      <Eventcalendar
        view={myView}
        data={secondEvents}
        resources={secondResources}
        height={420}
        dragToMove={true}
        eventDelete={true}
        externalDrag={true}
        externalDrop={true}
        onEventCreated={handleSecondCalEventCreated}
        className="md-drag-drop-second-calendar"
      />
      <Toast message={toastText} context={toastContext} isOpen={isToastOpen} onClose={handleCloseToast} />
    </div>
  );
}

export default App;
```

### TSX

```tsx
import {
  Eventcalendar,
  MbscCalendarEvent,
  MbscEventcalendarView,
  MbscEventCreatedEvent,
  MbscResource,
  setOptions,
  Toast,
} from '@mobiscroll/react';
import { FC, useCallback, useMemo, useState } from 'react';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

const App: FC = () => {
  const [isToastOpen, setToastOpen] = useState<boolean>(false);
  const [toastText, setToastText] = useState<string>('');
  const [toastContext, setToastContext] = useState<string>();

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

  const firstEvents = useMemo<MbscCalendarEvent[]>(
    () => [
      {
        start: '2026-11-02T00:00',
        end: '2026-11-05T00:00',
        title: 'Event 1',
        color: '#166f6f',
        resource: 1,
      },
      {
        start: '2026-11-15T00:00',
        end: '2026-11-19T00:00',
        title: 'Event 2',
        color: '#e20000',
        resource: 1,
      },
      {
        start: '2026-11-10T00:00',
        end: '2026-11-14T00:00',
        title: 'Event 3',
        color: '#1dab2f',
        resource: 2,
      },
      {
        start: '2026-11-20T00:00',
        end: '2026-11-23T00:00',
        title: 'Event 4',
        color: '#e25dd2',
        resource: 2,
      },
      {
        start: '2026-11-03T00:00',
        end: '2026-11-10T00:00',
        title: 'Event 5',
        color: '#4418d2',
        resource: 3,
      },
      {
        start: '2026-11-16T00:00',
        end: '2026-11-19T00:00',
        title: 'Event 6',
        color: '#4981d6',
        resource: 3,
      },
      {
        start: '2026-11-08T00:00',
        end: '2026-11-12T00:00',
        title: 'Event 7',
        color: '#6e7f29',
        resource: 4,
      },
      {
        start: '2026-11-22T00:00',
        end: '2026-11-28T00:00',
        title: 'Event 8',
        color: '#8b8b00',
        resource: 4,
      },
      {
        start: '2026-11-02T00:00',
        end: '2026-11-07T00:00',
        title: 'Event 9',
        color: '#a32f00',
        resource: 5,
      },
      {
        start: '2026-11-18T00:00',
        end: '2026-11-23T00:00',
        title: 'Event 10',
        color: '#152d2b',
        resource: 5,
      },
    ],
    [],
  );

  const firstResources = useMemo<MbscResource[]>(
    () => [
      {
        id: 1,
        name: 'Resource A',
      },
      {
        id: 2,
        name: 'Resource B',
      },
      {
        id: 3,
        name: 'Resource C',
      },
      {
        id: 4,
        name: 'Resource D',
      },
      {
        id: 5,
        name: 'Resource E',
      },
    ],
    [],
  );

  const secondEvents = useMemo<MbscCalendarEvent[]>(
    () => [
      {
        start: '2026-11-05T00:00',
        end: '2026-11-09T00:00',
        title: 'Event 1',
        color: '#4418d2',
        resource: 1,
      },
      {
        start: '2026-11-16T00:00',
        end: '2026-11-20T00:00',
        title: 'Event 2',
        color: '#8b1a1a',
        resource: 1,
      },
      {
        start: '2026-11-08T00:00',
        end: '2026-11-11T00:00',
        title: 'Event 3',
        color: '#e7b300',
        resource: 2,
      },
      {
        start: '2026-11-22T00:00',
        end: '2026-11-25T00:00',
        title: 'Event 4',
        color: '#a32f00',
        resource: 2,
      },
      {
        start: '2026-11-12T00:00',
        end: '2026-11-17T00:00',
        title: 'Event 5',
        color: '#21a833',
        resource: 3,
      },
      {
        start: '2026-11-23T00:00',
        end: '2026-11-29T00:00',
        title: 'Event 6',
        color: '#a917bb',
        resource: 3,
      },
      {
        start: '2026-11-04T00:00',
        end: '2026-11-10T00:00',
        title: 'Event 7',
        color: '#e20000',
        resource: 4,
      },
      {
        start: '2026-11-18T00:00',
        end: '2026-11-25T00:00',
        title: 'Event 8',
        color: '#4981d6',
        resource: 4,
      },
      {
        start: '2026-11-07T00:00',
        end: '2026-11-12T00:00',
        title: 'Event 9',
        color: '#166f6f',
        resource: 5,
      },
      {
        start: '2026-11-20T00:00',
        end: '2026-11-27T00:00',
        title: 'Event 10',
        color: '#d6d145',
        resource: 5,
      },
    ],
    [],
  );

  const secondResources = useMemo<MbscResource[]>(
    () => [
      {
        id: 1,
        name: 'Resource A',
      },
      {
        id: 2,
        name: 'Resource B',
      },
      {
        id: 3,
        name: 'Resource C',
      },
      {
        id: 4,
        name: 'Resource D',
      },
      {
        id: 5,
        name: 'Resource E',
      },
    ],
    [],
  );

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

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

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

  return (
    <div className="md-drag-drop-calendar">
      <div className="mbsc-form-group-title">Calendar 1</div>
      <Eventcalendar
        view={myView}
        data={firstEvents}
        resources={firstResources}
        height={420}
        dragToMove={true}
        eventDelete={true}
        externalDrag={true}
        externalDrop={true}
        onEventCreated={handleFirstCalEventCreated}
        className="md-drag-drop-first-calendar"
      />

      <div className="mbsc-form-group-title">Calendar 2</div>
      <Eventcalendar
        view={myView}
        data={secondEvents}
        resources={secondResources}
        height={420}
        dragToMove={true}
        eventDelete={true}
        externalDrag={true}
        externalDrop={true}
        onEventCreated={handleSecondCalEventCreated}
        className="md-drag-drop-second-calendar"
      />
      <Toast message={toastText} context={toastContext} isOpen={isToastOpen} onClose={handleCloseToast} />
    </div>
  );
};
export default App;
```

## Implementation notes

- Render two independent `Eventcalendar` instances on the same page, each with `timeline: { type: 'month' }` and `height: 420`.
- Each instance has its own separate dataset: 5 resources (A-E) and 10 events with `dyndatetime` offsets spread across the current month.
- Enable on both instances: `dragToMove: true`, `eventDelete: true`, `externalDrag: true`, `externalDrop: true`. Both `externalDrag` and `externalDrop` must be set on both calendars to allow bidirectional transfer - `externalDrag` permits dragging an event out, `externalDrop` permits receiving a drop from another instance.
- Handle `onEventCreated` on each instance. Inside the handler, check `args.action === 'externalDrop'` to distinguish a cross-calendar drop from a regular click-to-create or drag-to-create. When the condition is true, show a `Toast` confirming which calendar received the event.
- Scope each `Toast` to its calendar using the `context` prop (a CSS class or element selector pointing to the receiving calendar's wrapper). This positions the toast near the correct calendar rather than at the page level.

## Run it in your project

1. If not signed up yet, or don't own a license, you can [start a free trial](https://mobiscroll.com/starttrial).

2. Clone the repository:

   ```
   git clone https://github.com/acidb/mobiscroll-demos-react.git
   ```

3. If not installed yet, install the Mobiscroll CLI from NPM:

   ```
   npm install -g @mobiscroll/cli
   ```

4. Config Mobiscroll - open a terminal window in the root directory and run:

   ```
   mobiscroll config react
   ```

5. Install dependencies - open a terminal window in the root directory and run:

   ```
   npm install
   ```

6. Run the project:

   ```
   npm run dev
   ```

On a trial, add `--trial` to the config command: `mobiscroll config react --trial`.

Running a demo locally requires a Mobiscroll trial or a license; setup is per framework at https://mobiscroll.com/docs/react/getting-started/installation

## Related demos

- Previous: [Drag & Drop Restrictions per Event & Resource](https://demo.mobiscroll.com/react/timeline/conditional-move-resize-drag-drop-fixed-event-length-fixed-to-resource.md) - Restrict drag, move, and resize on a React Timeline per event, resource, or globally — lock events in time, fix length, or prevent resource switches.
- Next: [Prevent Event Overlap](https://demo.mobiscroll.com/react/timeline/prevent-double-booking-events.md) - Prevent double booking on the React Timeline — block overlaps per event, per resource, or globally, and show a toast on conflict.
