dr-niels-sortable-list

1.0.9 • Public • Published

This is a Polymer 3 conversion of the sortable-list element from pdgago (https://github.com/sharedlabs/sortable-list) with some minor adjustments. The readme was not updated and is still the one from the original sotable-list element!

License Published on webcomponents.org

Demo and API docs

GIF

sortable-list

sortable-list is a custom element that allows you to sort an element from a list by dragging it.

<sortable-list on-sort-finish="_onSortFinish" dragging="{{dragging}}">
  <div>Item 1</div>
  <div>Item 2</div>
  <div>Item 3</div>
</sortable-list>
 
...
onSortFinish(event) {
  const sortedItem = event.detail.target;
}

When using a dom-repeat you must specify which items are sortable.

<sortable-list sortable=".item">
  <dom-repeat>
    <div class="item"></div>
  </dom-repeat>
</sortable-list>

TODO:

  • Allow sort of elements with different sizes #2

Readme

Keywords

none

Package Sidebar

Install

npm i dr-niels-sortable-list

Weekly Downloads

10

Version

1.0.9

License

none

Unpacked Size

23.9 kB

Total Files

9

Last publish

Collaborators

  • nthole