Polymer 1.X and 2.X custom element for drag-and-drop reorder of items.
For typical use just wrap your dom-repeat template item with a <sortable-list>
element to get drag-and-drop reordering.
Relies on HTML 5 drag and drop browser support, so if you need to support older browsers which do not support HTML 5 drag and drop events then we suggest using a polyfill:
https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills
bower install --save polymer-sortable-list
<sortable-list>
<template is="dom-repeat" items='["item 1","item 2","item 3","item 4"]'>
<div style="height:30px;cursor:pointer;">[[item]]</div>
</template>
</sortable-list>
First, make sure you have the Polymer CLI installed. Then run polymer serve
to serve this element locally.
$ polymer serve
$ polymer test