Draggable is no longer maintained by its original authors. Maintenance of this repo has been passed on to new collaborators and is no longer worked on by anyone at Shopify.
We are still looking for more maintainers! If anyone is interested in answering / triaging issues, reviewing / rejecting / approving PRs, and authoring code for bug fixes / new features — please send an email to
curtis.dulmage (at) shopify (dot) com. You may be asked a few questions before obtaining collaboration permission, but if everything checks out, we will happily add you as a collaborator.
Get complete control over drag and drop behaviour with Draggable! Draggable abstracts
native browser events into a comprehensive API to create a custom drag and drop experience.
Draggable comes with additional modules:
itself does not perform any sorting behaviour while dragging, but does the heavy lifting, e.g.
creates mirror, emits events, manages sensor events, makes elements draggable.
The additional modules are built on top of
Draggable and therefore provide a similar API
interface, for more information read the documentation below.
- Works with native drag, mouse, touch and force touch events
- Can extend dragging behaviour by hooking into draggables event life cycle
- Can extend drag detection by adding sensors to draggable
- The library is targeted ES6 first
Table of Contents
NOTE: When installing with npm or yarn,
@firstname.lastname@example.org will be installed by default. If you want to install the latest version, please install
You can install the library via npm.
npm install @shopify/draggable --save
or via yarn:
yarn add @shopify/draggable
or via CDN
<!-- Entire bundle --> <script src="https://cdn.jsdelivr.net/npm/@email@example.com/lib/draggable.bundle.js"></script> <!-- legacy bundle for older browsers (IE11) --> <script src="https://cdn.jsdelivr.net/npm/@firstname.lastname@example.org/lib/draggable.bundle.legacy.js"></script> <!-- Draggable only --> <script src="https://cdn.jsdelivr.net/npm/@email@example.com/lib/draggable.js"></script> <!-- Sortable only --> <script src="https://cdn.jsdelivr.net/npm/@firstname.lastname@example.org/lib/sortable.js"></script> <!-- Droppable only --> <script src="https://cdn.jsdelivr.net/npm/@email@example.com/lib/droppable.js"></script> <!-- Swappable only --> <script src="https://cdn.jsdelivr.net/npm/@firstname.lastname@example.org/lib/swappable.js"></script> <!-- Plugins only --> <script src="https://cdn.jsdelivr.net/npm/@email@example.com/lib/plugins.js"></script>
|Package name||ES6 bundle sizes||ES5 bundle sizes|
You can find the documentation for each module within their respective directories.
(Added in: v1.0.0-beta.9)
Draggable includes TypeScript definitions.
To run the
examples project locally, simply run the following from the
yarn && yarn start
This will start a server that hosts the contents of
examples/. It also watches for file
changes from both
examples/src and reloads the browser.
Contributions are more than welcome, the code base is still new and needs more love.
For more information, please checkout the contributing document.
We are currently working on
v1.0.0-beta.12. Check out the project board to see tasks and follow progress on the release. Any Pull Requests should be pointed against the feature branch
Copyright (c) 2018 Shopify. See LICENSE.md for further details.