draggable README

The project's README from github.com/Shopify/draggable. As one markdown file: README.md.

npm version CI PRs Welcome Bundle size

Development

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 max.hoffmann (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: Sortable, Droppable, Swappable. Draggable 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.

Features

Table of Contents

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 type="module">
  import {
    Draggable,
    Sortable,
    Droppable,
    Swappable,
  } from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/index.mjs';
</script>
<!-- Draggable only -->
<script type="module">
  import Draggable from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/Draggable/Draggable.mjs';
</script>
<!-- Sortable only -->
<script type="module">
  import Sortable from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/Sortable/Sortable.mjs';
</script>
<!-- Droppable only -->
<script type="module">
  import Droppable from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/Droppable/Droppable.mjs';
</script>
<!-- Swappable only -->
<script type="module">
  import Swappable from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/Swappable/Swappable.mjs';
</script>
<!-- Plugins only -->
<script type="module">
  import * as Plugins from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/Plugins/index.mjs';
</script>
<!-- UMD browser -->
<script src="https://cdn.jsdelivr.net/npm/@shopify/draggable/build/umd/index.min.js"></script>
<script>
  console.log(window.Draggable);
</script>

Browser Compatibility

Check the "browserlist" property in package.json for more info

Chrome Firefox Opera Safari Edge
Last 3 versions ✔ Last 3 versions ✔ Last 3 versions ✔ Last 3 versions ✔ Last 3 versions ✔

Documentation

You can find the documentation for each module within their respective directories.

TypeScript

Draggable includes TypeScript definitions.

Documentation

Running examples

To run the examples project locally, simply run the following from the draggable root:

yarn && yarn start

This will start a server that hosts the contents of examples/. It also watches for file changes from both src/ and examples/src and reloads the browser.

Contributing

Contributions are more than welcome, the code base is still new and needs more love.

For more information, please checkout the contributing document.

Copyright (c) 2018-present Shopify. See LICENSE.md for further details.

draggable (Shopify/draggable)

Searching Database…

18.5K ·GitHub
archived
What is this?Draggable is an open-source JavaScript drag & drop library from Shopify. It abstracts native browser events into a comprehensive API so you can build fully custom drag-and-drop experiences in the browser.
Is it a framework I have to build around, or a plain library?A plain front-end library, ES6 first — no framework required. It ships TypeScript definitions, and the add-on modules (Sortable, Droppable, Swappable) are built on top of the core.
How do I add it to a project?Install it with npm install @shopify/draggable (or yarn add, or a CDN script tag), then wire it to the elements you want draggable through its API. Each module's documentation lives in its own directory in the repo.
Is it still actively maintained?No — the repo is archived and Shopify no longer works on it. Maintenance was handed to outside collaborators who fix bugs and review PRs, and they are still looking for more maintainers.
Can I try it without adding it to my own project first?Yes — the repo ships an examples project. Run the start script from the repo root and it serves the examples/ folder in your browser, live-reloading as you edit the library source or the example files.
How customizable is the drag behaviour?Quite a lot: you can hook into Draggable's event life cycle to extend dragging, add sensors for new kinds of input, and switch on plugins like Mirror, Scrollable, Collidable, ResizeMirror, Snappable, SwapAnimation, SortAnimation, Announcement and Focusable.
Is there anything for framework users?The README links community Ember CLI shims (on GitHub and npm) as related resources. The core stays framework-agnostic, and TypeScript definitions are included for typed projects.
What are similar projects?Sortable, muuri, moveable, interact.js, mojs, dragula, dropzone, iscroll
Creator
Shopify
Size
5.9 MB
Stars
18.5K
Age
9y
Commits · 90 Days