Skip to content
SortableExamples

Vanilla JS — Transfer between two lists

comins-sortable@0.1.6Vanilla JS

Reorder items within one list or transfer them to another. Both areas share one scope and group="tasks", with unique areaId values. Item IDs remain stable during transfer.

Drag the left handle into the empty list on the right. The done count increases and the item leaves the first list. Reset returns all items to their original order. Transfer in this example uses pointer interaction.

Drag a handle into the other list.
To do3
Design the docs
Build an example
Review the code
Done0

Done: 0 / 3

Create the first list with createSortable from the package root, then register the second through the same instance’s registerArea. The adapter applies DOM movement before onChange. If your app owns a separate data model, update it in that callback. This example uses the DOM as its source of truth. Release registration and destroy the instance on disposal.

Handles use touch-action: none and user-select: none to avoid competing touch scroll and text selection during a drag.

A temporary placeholder can still exist during onChange. Count actual item selectors instead of children.length. Refresh again in onAfterDrag to reflect cancellation or rollback.

Transfer, move between lists, drag and drop, reorder, shared scope.

npm 0.1.6 · Vanilla JS guide