vue-draggable-plus vs vuedraggable
Drag-and-Drop Lists in Vue 3 Applications
vue-draggable-plusvuedraggableSimilar Packages:

Drag-and-Drop Lists in Vue 3 Applications

Both vue-draggable-plus and vuedraggable are Vue components that wrap the SortableJS library to enable drag-and-drop functionality for lists. vuedraggable is the original and widely adopted wrapper, supporting both Vue 2 and Vue 3. vue-draggable-plus is a newer alternative built specifically for Vue 3, focusing on improved TypeScript support and alignment with modern Vue reactivity systems. Developers use these tools to create sortable lists, Kanban boards, and rearrangeable grids without managing low-level DOM events manually.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
vue-draggable-plus03,981215 kB1084 months agoMIT
vuedraggable020,615-2876 years agoMIT

Vue Drag-and-Drop Libraries: vue-draggable-plus vs vuedraggable

Both vue-draggable-plus and vuedraggable solve the same core problem β€” making lists sortable in Vue applications using SortableJS. However, they differ in how they handle Vue 3 reactivity, TypeScript definitions, and maintenance focus. Let's look at the technical differences that impact daily development.

πŸ“¦ Installation and Setup

vue-draggable-plus is installed as a modern Vue 3 package. It exports the component directly for use in <script setup>.

// vue-draggable-plus
import { VueDraggable } from 'vue-draggable-plus'

// Usage in template
// <VueDraggable v-model="items" ... />

vuedraggable requires ensuring you are on version 4+ for Vue 3 support. It uses a default export for the component.

// vuedraggable
import draggable from 'vuedraggable'

// Usage in template
// <draggable v-model="items" ... />

🎯 Component Structure and Slots

Both libraries use the v-model directive to sync the list state. However, how you render items inside the draggable area differs slightly in recommended patterns.

vue-draggable-plus encourages using the item slot for clarity and better Vue 3 integration.

<!-- vue-draggable-plus -->
<template>
  <VueDraggable v-model="tasks" item-key="id">
    <template #item="{ element }">
      <div>{{ element.title }}</div>
    </template>
  </VueDraggable>
</template>

vuedraggable supports the item slot in Vue 3 versions, but older patterns often used v-for directly on the component (which is discouraged in Vue 3).

<!-- vuedraggable -->
<template>
  <draggable v-model="tasks" item-key="id">
    <template #item="{ element }">
      <div>{{ element.title }}</div>
    </template>
  </draggable>
</template>

πŸ›‘οΈ TypeScript Support

Type safety is a major differentiator. Modern Vue projects rely heavily on TypeScript, and the quality of type definitions affects developer speed.

vue-draggable-plus ships with built-in TypeScript definitions. You get autocomplete for props like group, sort, and disabled without extra setup.

// vue-draggable-plus
// Types are inferred automatically
const handleEnd = (evt: any) => {
  console.log(evt.oldIndex, evt.newIndex)
}

vuedraggable has community-maintained types or requires manual declaration in some setups. You might need to augment types or cast props to avoid errors.

// vuedraggable
// May require manual type extension
interface DraggableProps {
  modelValue: any[]
  itemKey: string
}

⚑ Reactivity and Vue 3.6+ Compatibility

Vue 3.6+ introduced changes to how reactivity handles arrays and proxies. This broke some older wrappers.

vue-draggable-plus was built after these changes. It handles array mutations correctly without triggering excessive re-renders or losing state.

// vue-draggable-plus
// Handles splice/move events cleanly
const items = ref([{ id: 1 }, { id: 2 }])
// Dragging updates 'items' without warning logs

vuedraggable (early Vue 3 versions) had issues with reactivity warnings when moving items. While patched in later v4 releases, some edge cases still require workarounds.

// vuedraggable
// Older versions might log warnings on move
// Ensure using v4.1.0+ for best stability
const items = ref([{ id: 1 }, { id: 2 }])

πŸ“‘ Event Handling

Both libraries expose SortableJS events via Vue props. The naming convention is consistent, but type safety varies.

vue-draggable-plus provides typed event handlers. You know exactly what data evt contains.

<!-- vue-draggable-plus -->
<VueDraggable 
  v-model="list" 
  @end="onEnd"
/>

<script setup lang="ts">
const onEnd = (evt: any) => {
  // Fully typed event object
}
</script>

vuedraggable uses the same event names but may lack strict typing for the event payload in some IDEs.

<!-- vuedraggable -->
<draggable 
  v-model="list" 
  @end="onEnd"
/>

<script setup>
const onEnd = (evt) => {
  // evt structure depends on runtime
}
</script>

πŸ”§ Advanced Configuration: Groups

Connecting two lists together requires the group prop. Both handle this similarly, but syntax consistency matters.

vue-draggable-plus ensures the group object is reactive and typed.

<!-- vue-draggable-plus -->
<VueDraggable 
  v-model="listA" 
  :group="{ name: 'shared', pull: true, put: true }" 
/>

vuedraggable supports the same object structure. However, reactivity issues in older versions sometimes required wrapping the group object in toRef.

<!-- vuedraggable -->
<draggable 
  v-model="listA" 
  :group="{ name: 'shared', pull: true, put: true }" 
/>

🧩 Similarities: Shared Capabilities

Despite the differences, both libraries share the same underlying engine and core features.

1. Underlying Engine

  • Both use SortableJS for the heavy lifting.
  • Support touch devices, animations, and fallback classes.
// Both support standard SortableJS options
const options = {
  animation: 150,
  ghostClass: 'ghost'
}

2. Two-Way Binding

  • Both use v-model to sync the array.
  • Changes in the UI update the data, and data changes update the UI.
<!-- Both -->
<component v-model="myList" />

3. Custom Drag Handles

  • Both allow restricting drag to specific elements using handle.
<!-- Both -->
<component v-model="list" handle=".handle" />
<div class="handle">::</div>

4. Transition Support

  • Both work with Vue's <TransitionGroup> for move animations.
<!-- Both -->
<TransitionGroup name="list">
  <component v-model="list" />
</TransitionGroup>

5. Disabled State

  • Both support disabling drag via a boolean prop.
<!-- Both -->
<component v-model="list" :disabled="isReadOnly" />

πŸ“Š Summary: Key Differences

Featurevue-draggable-plusvuedraggable
Vue VersionVue 3 OnlyVue 2 & Vue 3
TypeScriptβœ… Built-in, Strong⚠️ Community/Manual
Reactivityβœ… Optimized for Vue 3.6+⚠️ Requires v4+
Maintenance🟒 Active, Vue 3 Focused🟑 Mature, Slower Updates
BundleπŸƒ LightweightπŸ“¦ Standard

πŸ’‘ The Big Picture

vue-draggable-plus is the modern choice for greenfield Vue 3 projects. It removes friction for TypeScript users and avoids known reactivity pitfalls. It feels like a native part of the Vue 3 ecosystem.

vuedraggable remains a solid option for teams maintaining Vue 2 apps or those who need a single solution for mixed Vue 2/3 repositories. It is stable but requires more care when configuring strict TypeScript environments.

Final Thought: If you are starting fresh with Vue 3 and TypeScript, vue-draggable-plus saves time on type definitions and debugging. If you are migrating an existing app using vuedraggable, staying on it is reasonable unless you hit specific reactivity bugs.

How to Choose: vue-draggable-plus vs vuedraggable

  • vue-draggable-plus:

    Choose vue-draggable-plus for new Vue 3 projects, especially those using TypeScript. It offers stronger type definitions and fixes specific reactivity issues found in older wrappers when used with Vue 3.6+. It is the better fit for teams prioritizing type safety and long-term maintenance in the modern Vue ecosystem.

  • vuedraggable:

    Choose vuedraggable if you are maintaining a legacy Vue 2 codebase or migrating incrementally to Vue 3. It is also suitable for JavaScript-only projects where strict TypeScript definitions are not a priority. Its long history means many existing tutorials and examples are available for reference.

README for vue-draggable-plus

NPM version NPM Downloads Docs & Demos
GitHub stars

vue-draggable-plus

δΈ­ζ–‡ζ–‡ζ‘£

Drag and drop sorting module, support Vue>=v3 or Vue>=2.7

Example of use

Describe

Since the vue3 component of Sortablejs has not been updated, it has been seriously out of touch with vue3, so this project was born. This component is based on Sortablejs, so if you want to know more about Sortablejs, you can check it out Sortablejs official website

We have encapsulated a variety of usages for this, you can use components, function, or instructions, there is always one that suits you

Solve pain points

In Sortablejs official Vue components in the past, the drag-and-drop list is implemented by using the component as a direct child element of the list. When we use some component libraries, if there is no slot for the root element of the list in the component library , it is difficult for us to implement a drag list, vue-draggable-plus perfectly solves this problem, it allows you to use a drag list on any element, we can use the selector of the specified element to get the root element of the list, and then Use the root element of the list as container of Sortablejs, for details, refer to specify target container.

Install


npm install vue-draggable-plus

Usage

Component usage

<template>
    <VueDraggable ref="el" v-model="list">
      <div v-for="item in list" :key="item.id">
        {{ item.name }}
      </div>
    </VueDraggable>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { VueDraggable } from 'vue-draggable-plus'

const list = ref([
  {
    name: 'Joao',
    id: 1
  },
  {
    name: 'Jean',
    id: 2
  },
  {
    name: 'Johanna',
    id: 3
  },
  {
    name: 'Juan',
    id: 4
  }
])
</script>

Function Usage

<template>
  <div ref="el">
    <div v-for="item in list" :key="item.id">
      {{ item.name }}
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useDraggable } from 'vue-draggable-plus'

const el = ref<HTMLElement | null>(null)
const list = ref([
  {
    name: 'Joao',
    id: 1
  },
  {
    name: 'Jean',
    id: 2
  },
  {
    name: 'Johanna',
    id: 3
  },
  {
    name: 'Juan',
    id: 4
  }
])
// The return value is an object, which contains some methods, such as start, destroy, pause, etc.
const draggable = useDraggable(el, list, {
  animation: 150,
  onStart() {
    console.log('start')
  },
  onUpdate() {
    console.log('update')
  }
})
</script>

Directive Usage

<template>
  <div
    v-draggable="[
        list,
        {
          animation: 150,
        }
      ]"
  >
    <div v-for="item in list" :key="item.id">
      {{ item.name }}
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { vDraggable } from 'vue-draggable-plus'
const list = ref([
  {
    name: 'Joao',
    id: 1
  },
  {
    name: 'Jean',
    id: 2
  },
  {
    name: 'Johanna',
    id: 3
  },
  {
    name: 'Juan',
    id: 4
  },
  {
    name: 'Yuan',
    id: 5
  }
])

function onStart() {
  console.log('start')
}

function onUpdate() {
  console.log('update')
}
</script>

Explanation

All event functions starting with on can be passed to components using v-on. For example:


<template>
  <VueDraggable v-model="list" @start="onStart" @end="onEnd"></VueDraggable>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import { VueDraggable } from 'vue-draggable-plus'
import { SortableEvent } from "sortablejs";

const list = ref([
  {
    name: 'Joao',
    id: '1'
  },
  {
    name: 'Jean',
    id: '2'
  },
  {
    name: 'Johanna',
    id: '3'
  },
  {
    name: 'Juan',
    id: '4'
  }
])

function onStart(event: SortableEvent) {
  console.log('start drag')
}

function onEnd(event: SortableEvent) {
  console.log('end drag')
}
</script>

For information on using Hooks and directives, please refer to the documentation.

Options

Options inherits all configuration items from Sortablejs. For details, please see the Sortablejs official documentation.

Types

type Easing =
  | 'steps(int, start | end)'
  | 'cubic-bezier(n, n, n, n)'
  | 'linear'
  | 'ease'
  | 'ease-in'
  | 'ease-out'
  | 'ease-in-out'
  | 'step-start'
  | 'step-end'
  | 'initial'
  | 'inherit'

type PullResult = ReadonlyArray<string> | boolean | 'clone';
type PutResult = ReadonlyArray<string> | boolean;

interface GroupOptions {
  /**
   * Group name.
   */
  name: string;
  /**
   * The ability to move from the list. Clone - copy the item instead of moving it.
   */
  pull?: PullResult | ((to: Sortable, from: Sortable, dragEl: HTMLElement, event: SortableEvent) => PullResult) | undefined;
  /**
   * Whether elements can be added from other lists, or an array of group names from which elements can be obtained.
   */
  put?: PutResult | ((to: Sortable, from: Sortable, dragEl: HTMLElement, event: SortableEvent) => PutResult) | undefined;
  /**
   * After moving to another list, the cloned element is restored to its initial position.
   */
  revertClone?: boolean | undefined;
}

type Group = string | GroupOptions | undefined;

type ScrollFn = ((
        this: Sortable,
        offsetX: number,
        offsetY: number,
        originalEvent: Event,
        touchEvt: TouchEvent,
        hoverTargetEl: HTMLElement,
    ) => 'continue' | void) | undefined;

API

ParameterDescriptionTypeDefault
animationShow animation while draggingNumber0
chosenClassCSS class name for chosen itemString'sortable-chosen'
delayDelay in milliseconds before drag startsNumber0
delayOnTouchOnlyDelay on touch eventBooleanfalse
directionDragging direction, 'vertical' or 'horizontal' (default auto detect)String-
disabledDisable draggingBooleanfalse
dragClassCSS class name for dragged itemString'sortable-drag'
draggableSelector for draggable items within elementString-
emptyInsertThresholdDistance (in pixels) from empty sortable items where dragging element should be inserted. Set to 0 to disable this feature.Number5
easingAnimation easingEasing-
fallbackClassCSS class name for cloned DOM elements when using forceFallbackStringsortable-fallback
fallbackOnBodyAppend cloned DOM element to body elementBooleanfalse
fallbackTolerancePixels mouse must move before drag start when using forceFallbackNumber0
filterSelector for items that should not be draggableString-
forceFallbackIgnore HTML5 drag and drop behavior and force fallbackBooleanfalse
ghostClassCSS class name for drop placeholderString'sortable-ghost'
groupGroup items to drag between sortable lists. Both lists must have the same group value. Also define whether lists can be dragged out of, cloned, or receive elements from other lists. See TypeScript type definition above for details.Group-
handleSelector for handle to initiate drag. If not set, the target element's children are usedString-
invertSwapAlways use inverted swap zone if set to trueBooleanfalse
invertedSwapThresholdInverted swap zone threshold, defaults to swapThreshold valueNumber-
preventOnFilterCall event.preventDefault() on filter eventBooleantrue
removeCloneOnHideRemove instead of hiding cloned element when not displayedBooleantrue
sortAllow list items to be sorted within containerBooleantrue
swapThresholdSwap zone thresholdNumber1
touchStartThresholdPixels before cancelling delay touch eventNumber1
setDataPass a function where the first argument is of type DataTransfer and the second argument is of type HTMLElementFunction-
scrollEnable scrollingBooleanHTMLElement
scrollFnCustom scroll functionScrollFn-
scrollSensitivityThe distance in pixels the mouse must be to the edge to start scrollingNumber-
scrollSpeedThe scrolling speed in ms/pxnumber-
bubbleScrollEnables automatic scrolling for all parent elements to make it easier to move itemsBooleantrue
onChooseTriggered when an item is selected((event: SortableEvent) => void)-
onUnchooseTriggered when an item is deselected((event: SortableEvent) => void)-
onStartTriggered when an item is picked up for drag and drop((event: SortableEvent) => void)-
onEndTriggered when an item is no longer being dragged((event: SortableEvent) => void)-
onAddTriggered when an item is moved from one list to another((event: SortableEvent) => void)-
onUpdateTriggered when the order of the items is updated((event: SortableEvent) => void)-
onSortTriggered whenever any changes are made to the list((event: SortableEvent) => void)-
onRemoveTriggered when an item is removed from the list and moved to another((event: SortableEvent) => void)-
onFilterTriggered when trying to drag a filtered item((event: SortableEvent) => void)-
onMoveTriggered while an item is being dragged((event: MoveEvent,originalEvent: Event) => void)-
onCloneTriggered when an item is cloned((event: SortableEvent) => void)-
onChangeTriggered when an item is dragged and changes position((event: SortableEvent) => void)-