SortableJS JavaScript library for reorderable lists with cross-list moves, cloning and optional sorting plugins.
Overview SortableJS adds drag-and-drop ordering to lists of DOM elements. It supports moving items within or between lists, drag handles, cloning and configurable sorting behavior. It is an open-source interaction library rather than a complete board application or a persistence service.[1] [2]
Contents Configuring list interactions A list can be made sortable directly from its element. Shared group configuration enables transfers, while cloning keeps the original item in its source list. Drag handles limit the area that starts movement, and filters can exclude controls or items. Sorting within a source list can be disabled while allowing transfers out of it. These distinctions are useful for interfaces such as an asset palette beside an ordered destination list, where copying and moving have different meanings.[1]
Events and saved ordering Events expose movement information, including indices for all children and separate indices counting draggable children. The library's Store interface can read an initial order and save it on drop; the documented example uses localStorage and item IDs. This demonstrates a browser-local persistence hook, not a backend synchronization service. An application's own state and durable ordering need to follow the intended event path.[2]
Multi-item and swap behavior MultiDrag permits selecting several elements and moving them together. Its event payload includes arrays of items and their indices. During sorting, selected elements other than the principal dragged element can have an intermediate new index of -1 because of folding or removal from the DOM. Code should not treat those intermediate values as completed positions. The separate Swap plugin instead exchanges the dragged item with the drop target rather than inserting it through ordinary sorting; it exposes that target as swapItem.[4] [5]
React wrapper qualifications The separate react-sortablejs repository explicitly warns that its bindings are not considered production-ready. It explains that Sortable changes DOM nodes and the wrapper reverses some actions so React can reconcile state. Its guide requires stable item keys rather than array indices and records unresolved nested-list state-update behavior. These warnings apply to that integration; they should not be silently generalized to every use of the underlying vanilla library or omitted when recommending it for a React project.[3]
Packaging and reuse The project offers default, core and complete builds, with plugins included or mounted according to the selected build. It documents a native HTML drag-and-drop path and a forceFallback option. Generated integration code should match the actual import and plugin setup instead of assuming every optional behavior is enabled. The MIT license permits reuse and redistribution subject to retaining its notices.[2] [6]
Substitution considerations SortableJS can replace dnd kit for list-focused reordering when a direct DOM-oriented library fits the application. dnd kit offers a layered interaction model with framework adapters and extensible sensors. Neither API can simply replace the other without revisiting events, state updates and styling. Accessibility behavior and framework compatibility should be tested in the finished interface; this submission reports documentation research, not an installation or interaction test.[2] [7]
Also included: 4 capabilities and 0 substitute relationships. Check substitutes in section 1 and capabilities in section 3.