@scalar/draggable
A simple vue wrapper around html drag and drop
7,958,039
16,329
| Install | |
|---|---|
npm install @scalar/draggable |
|
| Latest Version: | 0.4.7 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 28, 2026 |
| Links: | GitHub · npm |
Maintainer: cameronrohani
Scalar Draggable component
Scalar is an open-source API platform for teams who want beautiful developer interfaces without vendor lock-in.
- API References — Interactive API documentation from OpenAPI and AsyncAPI specs.
- Developer Docs — Write in Markdown/MDX, generate API references, sync with two-way Git.
- SDK Generator — Type-safe SDKs and CLIs in TypeScript, Python, Go, PHP, Java, and Ruby.
- API Client — Open-source, offline-first Postman alternative built on OpenAPI.
20M+ monthly npm installs · 15,500+ GitHub stars · MIT licensed · scalar.com
Installation
npm install @scalar/draggable
Usage
A complete example can be found the playground, but basically you need a data structure like:
const sidebar = ref({
// Master list of all items
items: {
'1': {
id: '1',
name: 'Rangers',
children: ['2', '4', '5', '6', '7'],
},
'2': {
id: '2',
name: 'Stars',
children: ['3'],
},
'3': { id: '3', name: 'Bruins', children: [] },
'4': { id: '4', name: 'Canucks', children: [] },
'5': { id: '5', name: 'Panthers', children: [] },
'6': { id: '6', name: 'Avalanche', children: [] },
'7': { id: '7', name: 'Hurricanes', children: [] },
'8': { id: '8', name: 'Jets', children: [] },
'9': { id: '9', name: 'Oilers', children: [] },
'10': { id: '10', name: 'Predators', children: [] },
'11': { id: '11', name: 'Maple Leafs', children: [] },
'12': { id: '12', name: 'Kings', children: [] },
} satisfies Items,
// Root level children (the top level of the sidebar)
children: ['1', '8', '9', '10', '11', '12'],
})
Then you will need a recursive component that wraps Draggable like:
<template>
<Draggable
:id="id"
:ceiling="0.8"
:floor="0.2"
:height="30"
:parentIds="[...parentIds, id]">
<div
class="sidebar-item"
:class="{ 'sidebar-folder': items[id].children.length }">
{{ items[id].name }}
<SidebarItem
v-for="childId in items[id].children"
:id="childId"
:key="childId"
:items="items"
:parentIds="[...parentIds, id]" />
</div>
</Draggable>
</template>
Then manage the data manipluation on drop using the emitted events!
Example
You can find an example in this repo under the playground
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.4.7 | ^3.5.44 | MIT | |
| 0.4.6 | ^3.5.40 | MIT | |
| 0.4.5 | ^3.5.40 | MIT | |
| 0.4.4 | ^3.5.40 | MIT | |
| 0.4.3 | ^3.5.30 | MIT | |
| 0.4.2 | ^3.5.30 | MIT | |
| 0.4.1 | ^3.5.26 | MIT | |
| 0.4.0 | ^3.5.26 | MIT | |
| 0.3.0 | ^3.5.21 | MIT | |
| 0.2.0 | ^3.5.12 | MIT | |
| 0.1.11 | ^3.5.12 | MIT | |
| 0.1.10 | ^3.5.12 | MIT | |
| 0.1.9 | ^3.5.12 | MIT | |
| 0.1.8 | ^3.5.12 | MIT | |
| 0.1.7 | ^3.5.12 | MIT | |
| 0.1.6 | ^3.5.12 | MIT | |
| 0.1.5 | ^3.4.29 | MIT | |
| 0.1.4 | ^3.4.29 | MIT | |
| 0.1.3 | ^3.4.22 | MIT | |
| 0.1.2 | ^3.4.22 | MIT | |
| 0.1.1 | ^3.3.0 | MIT | |
| 0.1.0 | ^3.3.0 | MIT | |
| 0.0.7 | ^3.3.0 | MIT | |
| 0.0.6 | ^3.3.0 | MIT | |
| 0.0.5 | ^3.3.0 | MIT | |
| 0.0.2 | ^3.3.0 | MIT |