TEMPLATE FEATURES

 

 

Nestable

Create nestable lists that can be sorted by drag and drop.

The Nestable allows you to sort items through drag and drop. This is great, if you want to organize different categories or menu items in administration areas, for example.


Usage

A nestable list consists of the list itself and its items, a handle and a toggle.

Class/Data attributeDescription
.uk-nestable Add this class to a <ul> element to define the component.
data-uk-nestable To enable the necessary JavaScript, just add this data attribute.
.uk-nestable-item Add this class to a <div> element inside each list item.
.uk-nestable-handle This class creates the handle to enable drag and drop sorting.
data-nestable-action="toggle" This data attribute allows you to hide or show nested list items.

Example

  •  
     
    Item 1
  •  
     
    Item 2
  •  
     
    Item 3

Markup

<ul class="uk-nestable" data-uk-nestable>
    <li>
        <div class="uk-nestable-item">
            <div class="uk-nestable-handle"></div>
            <div data-nestable-action="toggle"></div>
            ...
        </div>
    </li>
</ul>

Sort multiple lists

To be able to sort items from one list to another, you can group them by adding the data-uk-nestable="{group:'GROUP-NAME'}" attribute to each list. By default, lists without any group name are automatically in the same group.

Example

  •  
     
    Item 1
  •  
     
    Item 2
  •  
     
    Item 3

Second list

  •  
     
    Item 4

Markup

<ul class="uk-nestable" data-uk-nestable="{group:'my-group'}">...</ul>
<ul class="uk-nestable" data-uk-nestable="{group:'my-group'}">...</ul>

Disable nesting

To disable nesting of list items, just add the data-uk-nestable="{maxDepth:1}" attribute. You can also use this data attribute to determine to what depth nesting is possible.

  •  
     
    Item 1
  •  
     
    Item 2
  •  
     
    Item 3

Markup

<ul class="uk-nestable" data-uk-nestable="{maxDepth:1}">...</ul>

JavaScript options

This is an example of how to set options via attribute:

data-uk-nestable="{maxDepth:0, group:'widgets'}"
OptionPossible valueDefaultDescription
group integer (0..6) 0 List group
maxDepth integer 10 Max nesting level
threshold integer 20 Pixel threshold before starting to drag
listNodeName string ul List node name
itemNodeName string li Item node name
listBaseClass string uk-nestable List base class
listClass string uk-nestable-list List class
listitemClass string uk-nestable-list-item List item class
itemClass string uk-nestable-item Item class
dragClass string uk-nestable-list-dragged Class added to dragged list
movingClass string uk-nestable-moving Class added to <html> when moving
handleClass string uk-nestable-handle Class for drag handle
collapsedClass string uk-nestable-collapsed Class for collapsed items
placeClass string uk-nestable-placeholder Class for placeholder of currently dragged element
noDragClass string uk-nestable-nodrag Elements with this class will not trigger dragging. Useful when having the complete item draggable and not just the handle.
emptyClass string uk-nestable-empty Class for empty lists

Init element manually

var nestable = UIkit.nestable(element, { /* options */ });

Events

NameParameterDescription
start.uk.nestable event, nestable object On nestable drag start
move.uk.nestable event, nestable object On nestable move item
stop.uk.nestable event, nestable object On nestable stop dragging
change.uk.nestable event, nestable item, action On nestable change item

About Us

Curabitur sollicitudin neque ante, commodo efficitur libero semper et. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam at suscipit mi. Maecenas et elit sem. Suspendisse a laoreet sem. Integer facilisis, magna at volutpat volutpat

Business Hours

Our support Hotline is available 24 Hours a day: (+61) 023 456 7805

Monday-Friday: 9am to 5pm
Saturday: 10am to 2pm
Sunday: Closed from 10am
Public Holidays: Closed all day

client1.jpgclient2.jpgclient3.jpgclient4.jpgclient5.jpgclient6.jpgclient7.jpgclient8.jpgclient9.jpg