Create sortable grids and lists to rearrange the order of its elements.


Create sortable grids and lists to rearrange the order of its elements.

Drag and drop an element to a new location within the sortable grid, while the other items adjust to fit. This is great, if you want to sort items like gallery or menu items, for example.


To apply this component, add the uk-sortable attribute to a container and create child elements.

<div uk-sortable>


By default, the entire sortable element can be used for drag and drop sorting. To create a handle which will be used instead, just add the handle: SELECTOR option to the attribute and add the handle class to the element that you want to use as a handle.

<ul uk-sortable="handle: .uk-sortable-handle">
        <div class="uk-sortable-handle"></div></li>


To be able to sort items from one list to another, you can group them by adding the group: GROUP-NAME option to the uk-sortable attribute on each list.

<div uk-sortable="group: my-group">

<div uk-sortable="group: my-group">

Custom class

You can also apply one or more custom classes to items when they are being dragged. To do so, add the cls-custom: MY-CLASS option to the attribute.

<ul uk-sortable="cls-custom: my-class"></ul>

Note In this example, we are using a nav from the Nav component. When dragging an item it will get a box-shadow and background.

Component options

Any of these options can be applied to the component attribute. Separate multiple options with a semicolon. Learn more

groupString''The group
animationString, Boolean‘slide’Animation mode: slide, false.
durationNumber250Animation duration in milliseconds.
thresholdNumber5Mouse move threshold before dragging starts.
cls-itemStringuk-sortable-itemThe item class.
cls-placeholderStringuk-sortable-placeholderThe placeholder class.
cls-dragStringuk-sortable-dragThe ghost class.
cls-drag-stateStringuk-dragThe body’s dragging class.
cls-baseStringuk-sortableThe list’s class.
cls-no-dragStringuk-sortable-nodragDisable dragging on elements with this class.
cls-emptyStringuk-sortable-emptyThe empty list class.
cls-customString''The ghost’s custom class.
handleStringfalseThe handle selector.


Learn more about JavaScript components.


UIkit.sortable(element, options);


The following events will be triggered on elements with this component attached:

startFires after dragging starts.
stopFires after dragging stops.
movedFires after an element has been moved.
addedFires after an element has been added.
removedFires after an element has been removed.