Warning
This library is no longer actively maintained. It will continue to receive critical security updates, but there are no new features planned. In future versions of React, the
findDOMNode
method will be deprecated. This method is a critical piece of the architecture ofreact-sortable-hoc
, and the library will stop working in the future when that method is removed fromreact-dom
.All development efforts have been redirected towards @dnd-kit. It provides feature parity, built with a modern and extensible architecture, supports complex use-cases and has accessibility features built-in. New consumers are strongly encouraged to adopt @dnd-kit instead of adopting
react-sortable-hoc
.
A set of higher-order components to turn any list into an animated, accessible and touch-friendly sortable list
Examples available here: http://clauderic.github.io/react-sortable-hoc/
- Higher Order Components – Integrates with your existing components
- Drag handle, auto-scrolling, locked axis, events, and more!
- Suuuper smooth animations – Chasing the 60FPS dream 🌈
- Works with virtualization libraries: react-virtualized, react-tiny-virtual-list, react-infinite, etc.
- Horizontal lists, vertical lists, or a grid ↔ ↕ ⤡
- Touch support 👌
- Accessible: supports keyboard sorting
Using npm:
$ npm install react-sortable-hoc --save
Then, using a module bundler that supports either CommonJS or ES2015 modules, such as webpack:
// Using an ES6 transpiler like Babel
import {SortableContainer, SortableElement} from 'react-sortable-hoc';
// Not using an ES6 transpiler
var Sortable = require('react-sortable-hoc');
var SortableContainer = Sortable.SortableContainer;
var SortableElement = Sortable.SortableElement;
Alternatively, an UMD build is also available:
<script src="react-sortable-hoc/dist/react-sortable-hoc.umd.js"></script>