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

<script setup>
import {
  MbscEventcalendar,
  MbscPage,
  MbscToast,
  setOptions 
} from '@mobiscroll/vue'
import { ref } from 'vue'

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

const myView = {
  calendar: { type: 'month' }
}

const firstEvents = ref([
  {
    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 = ref([
  {
    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 toastMessage = ref('')
const toastContext = ref()
const isToastOpen = ref(false)

function handleFirstCalEventCreated(args) {
  if (args.action === 'externalDrop') {
    toastMessage.value = 'Event dropped to Calendar 1'
    toastContext.value = '.md-drag-drop-first-calendar'
    isToastOpen.value = true
  }
}

function handleSecondCalEventCreated(args) {
  if (args.action === 'externalDrop') {
    toastMessage.value = 'Event dropped to Calendar 2'
    toastContext.value = '.md-drag-drop-second-calendar'
    isToastOpen.value = true
  }
}

function handleToastClose() {
  isToastOpen.value = false
}
</script>

<template>
  <MbscPage>
    <div class="mbsc-grid mbsc-no-padding md-drag-drop-calendar">
      <div class="mbsc-row">
        <div class="mbsc-col-sm-6 md-drag-drop-calendar-border">
          <div class="mbsc-form-group-title">Calendar 1</div>
          <MbscEventcalendar
            :view="myView"
            :data="firstEvents"
            :height="550"
            :dragToMove="true"
            :eventDelete="true"
            :externalDrag="true"
            :externalDrop="true"
            @event-created="handleFirstCalEventCreated"
            className="md-drag-drop-first-calendar"
          />
        </div>
        <div class="mbsc-col-sm-6">
          <div class="mbsc-form-group-title">Calendar 2</div>
          <MbscEventcalendar
            :view="myView"
            :data="secondEvents"
            :height="550"
            :dragToMove="true"
            :eventDelete="true"
            :externalDrag="true"
            :externalDrop="true"
            @event-created="handleSecondCalEventCreated"
            className="md-drag-drop-second-calendar"
          />
        </div>
      </div>
    </div>
    <MbscToast
      :message="toastMessage"
      :context="toastContext"
      :isOpen="isToastOpen"
      @close="handleToastClose"
    />
  </MbscPage>
</template>

<style>
.md-drag-drop-calendar-border {
  border-right: 3px dashed #e4e4e4;
}

.md-drag-drop-calendar .mbsc-form-group-title {
  font-size: 1em;
}

.md-drag-drop-calendar .mbsc-row,
.md-drag-drop-calendar .mbsc-col-sm-6 {
  height: 100%;
}
</style>

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.