Blazor Sortable List

The Blazor Bootstrap Sortable List component, built on top of SortableJS, enables drag-and-drop reordering of lists.

Setup #

Before using the SortableList component, include the SortableJS script reference in your index.html/_Host.cshtml file.
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>

Examples #

Shared lists #

To drag-and-drop an item from one list to the other and vice versa, set the Group parameter for all the lists. Providing the same Group name for the lists is what links them together.

In the below example, both lists use the same Group.

In the following example, all three lists use the same group.

Cloning #

By setting Pull="SortableListPullMode.Clone", you can enable item cloning. Drag an item from one list to another to create a copy that stays in the original list.

Disable sorting #

You can disable list sorting by setting AllowSorting="false". In the example below, the list cannot be sorted.

Handle #

The Handle parameter specifies the CSS class that denotes the drag handle. In the example below, items can only be sorted by dragging the handle itself.

Disable item #

Try dragging the red-backgrounded item. You won't be able to, as it's disabled using the DisableItem parameter.

Nested sortables #

Nested list sorting is not currently supported. We will add this feature in upcoming releases.

Dynamic data #

Empty data #