Multi-drag
Hold Ctrl (or Cmd on macOS) and click items to add them to the selection. Then drag any selected item to move the whole batch.
- January
- February
- March
- April
- May
- June
- July
Tip: Shift+click selects a range.
How it was wired
import { Sortable } from '../src/index.ts'
// In v2, multi-drag is built into the core — set `multiDrag: true`
// on the instance. There is no MultiDragPlugin to mount (the v1-compat
// shim was removed in #34).
new Sortable(document.getElementById('multi-list'), {
animation: 150,
draggable: '.sortable-item',
multiDrag: true,
selectedClass: 'sortable-selected',
onSelect: (evt) => {
console.log('selection changed', evt.items?.length ?? 0, 'items')
},
})
Migration note: if you're porting from v1's
MultiDrag plugin, remove the
Sortable.mount(new MultiDrag()) call. v2 has no
MultiDragPlugin — the
multiDrag: true option is everything you need.