vuedraggable-es is a Vue.js 3 component that enables drag-and-drop functionality for lists, keeping the view model array synchronized with the HTML. It is built upon and exposes all features of Sortable.js, including touch device support, drag handles, smart auto-scrolling, and inter-list dragging. The current stable version is 4.1.1, and it is actively maintained with frequent bug fixes and feature enhancements, as seen in the recent release history. A key differentiator is its explicit compatibility with Vue 3's `transition-group` component and its focus on being an ES module, making it suitable for modern Vue projects. It also allows making existing UI library components draggable while maintaining full control via events. Its development follows the `vue.draggable.next` project, targeting Vue 3 exclusively.
npm install vuedraggable-esVerified import paths — ran on the pinned version, not inferred.
Demonstrates a basic draggable list using `vuedraggable-es` with Vue 3's Composition API, `v-model` for synchronization, and event handling for drag start/end states in a single file component.
For Vue 2 projects, you must use the `vuedraggable` package (without the `-es` suffix). For Vue 3 projects, ensure your `vue` peer dependency is `^3.2.31` or higher for `vuedraggable-es`.
Always provide a unique `item-key` prop that points to a stable identifier on your list items, e.g., `:item-key="'id'"` or `:item-key="element => element.uniqueId"`.
Ensure your structure follows the pattern: `<draggable v-model="myArray" tag="transition-group" item-key="id"><template #item="{element}"><div>{{element.name}}</div></template></draggable>`.Always use `import draggable from 'vuedraggable-es'` and ensure your build setup (Vite, Webpack, Rollup) is configured to handle ES modules correctly. If you encounter issues, verify your `package.json` `type` field is set to `module` or that your bundler explicitly handles ESM.
Ensure `import draggable from 'vuedraggable-es'` is present in your script and that `draggable` is registered in your component's `components` option or globally if not using `<script setup>`.
Add the `item-key` prop to the `<draggable>` component, e.g., `:item-key="'id'"`, pointing to a unique identifier property within your list items.
If your project is Vue 2, you must uninstall `vuedraggable-es` and install the `vuedraggable` package. If your project is Vue 3, ensure your `vue` package version meets the `vuedraggable-es` peer dependency requirements (e.g., `^3.2.31`).