adopted-ember-addons /ember-sortable

Sortable UI primitives for Ember.js

★ 298⑂ 161👁 15⑃ 473● 222▤ 65
TypeScriptMITCreated 2015-04-23ember-sortable.netlify.app/
Download: v5.5.0v5.5.0 ↓5.5.02026-11-09
+0
Daily
298
stars
161
forks
15
watchers
473
prs
222
issues
65
releases

README

ember-sortable







Sortable UI primitives for Ember.

Check out the demo

 Requirements

| Ember Sortable | Ember | Node |
|----------------|-------|------|
| 3.0.0          | 3.24+ | 12+  |
| 4.0.0          | 3.24+ | 14+  |
| 5.0.0          | 3.28+ | n/a[^1]  |

[^1]: Node is not relevant for v2 addons. As of v5.0.0, ember-sortable is a v2 addon. V2 addons don't have to be for browser-only contexts, but ember-sortable is -- so node is not relevant anymore. This is different from v1 addons, which are not browser libraries, but node programs that happen emit browser code to the consuming app at app-build time.

 Installation

sh
$ ember install ember-sortable


 Usage

hbs
{{! app/components/my-list/template.hbs }}


  {{each this.items as |item|}}
    
      {{item}}
      ↕
    
  {{/each}}


The last dragged item was: {{this.lastDragged}}


The onChange action is called with two arguments:

- Your item models in their new order
- The model you just dragged

js
// app/components/my-list/component.js

export default class MyList extends Component {
  @tracked lastDragged;
  @tracked items = ['Coal Ila', 'Askaig', 'Bowmore'];

  @action
  reorderItems(itemModels, draggedModel) {
    this.items = itemModels;
    this.lastDragged = draggedModel;
  }
}


The modifier version does not support groupModel, use the currying of action or the fn helper.

hbs
{{! app/components/my-list/template.hbs }}


  {{each this.items as |item|}}
    
      {{item}}
      ↕
    
  {{/each}}



 Changing sort direction

To change sort direction, define direction on sortable-group
Possible values are:
- y (default): allowes to move items up/down
- x: allowes to move items left/right
- grid: items can be moved in all directions inside a group

hbs



 Changing spacing between currently dragged element and the rest of the group

When user starts to drag element, other elements jump back. Works for all direction option.

In y case: elements above current one jump up, and elements below current one - jump down.
In x / grid case: elements before current one jump to the left, and elements after current one - jump to the right.

To change this property, define spacing on sortable-item (default is 0):

hbs



 Changing the drag tolerance

distance attribute changes the tolerance, in pixels, for when sorting should start.
If specified, sorting will not start until after mouse is dragged beyond distance.
Can be used to allow for clicks on elements within a handle.

hbs



 Disabling reordering

The disabled attribute allows you to disable sorting for the entire group and its child items.

hbs



 CSS, Animation

Sortable items can be in one of four states: default, dragging, dropping, and activated.
The classes look like this:

html

...

...

...

...


In our example app.css we apply a
transition of .125s in the default case:

css
.sortable-item {
  transition: all 0.125s;
}


While an item is dragging we want it to move pixel-for-pixel with the
user’s mouse so we b

Top issues

Latest release

v5.5.0 v5.5.0 2026-11-09
Release (2026-11-09)

 ember-sortable 5.5.0 (minor)

 :rocket: Enhancement
 ember-sortable
   691 Assign the item state directly instead of with set() (@johanrd)
   690 Declare the modifiers' actions as arrow functions (@johanrd)

 :bug: Bug Fix
 ember-sortable
   693 Only drag on auto scroll when the container scrolled (@johanrd)
   688 Recompute firstItemPosition, and drop the last @computed (@johanrd)

 :memo: Documentation
 689 Use a plain array in the autoscroll demo (@johanrd)

 Committers: 1
- Johan Røed (@johanrd)

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON