Extras
Sortable
Bit.BlazorUI.ExtrasSortableListReorderableListDragAndDropList
BitSortable is a drag-and-drop sortable list, inspired by SortableJS: reorder the items of a list, or drag them between lists that share a Group - with live reordering, slide animations, clone and move pull modes, swap thresholds, drag handles, filters, nested lists, swap mode, multi-drag and the keyboard, every step announced to screen readers.
Pull, put & handles
Cloning items out of a palette, the Sort, Put and Pull rules of a list, disabling it, and what may start a drag: drag handles and filters.
Clone
With Pull set to Clone, what leaves a list is a copy and the original stays, so the same item can be
dragged out again and again; with the mouse, the cursor shows a copy while the item is over another list. The
Clone factory makes the copy; without one an ICloneable item is cloned and any other is shared. The palette
here is a plain array: a read-only list - an array, a ReadOnlyCollection<T>, an ImmutableList<T> - is
shown and cloned from, but never sorted, pulled from or dropped into, so it needs no Sort or Put of its own and is
bound one way, with Items. A clone source that is a mutable list still sorts within itself and takes items
back: only what leaves it is a copy, and what is dragged out of the form moves as usual.
- The copy must be a distinct item: a list holds an item once, so a copy that equals an item already in the target is refused. That is why the fields here are a class, compared by reference - two records with the same values would be equal, and the second one refused - and why a shared item works for an immutable reference type but not for the same string twice. With ItemKey, the factory gives a copy a key of its own.
- In the events that follow the drop, Item is the copy and IsClone is true, and OnRemove is not raised: nothing left the source.
- Combined with Swap, a clone source gives its item itself away in the swap rather than a copy; combined with MultiDrag, dragging into another list clones only the dragged item.
Palette
Text box
Checkbox
Drop-down
Date
To pick up the item, press Space or Enter. While it is picked up, the arrow keys move it, Home and End move it to the start or the end of its list, Space or Enter drops it, and Escape puts it back.
Form
Drag fields from the palette.
To pick up the item, press Space or Enter. While it is picked up, the arrow keys move it, Home and End move it to the start or the end of its list, Space or Enter drops it, and Escape puts it back.
Form:
Sort, Put & Pull
Each list says what it allows. Sort set to false keeps its own order, Put set to false refuses the
items of other lists, and Pull set to None keeps its items in it while it still sorts and takes
items in. The items of the first list can only be dragged out; those of the second never leave.
- Sort="false": no reordering within, items still drag out, and items of other lists still drop in where they are dropped - Sort keeps the list's own items in their order, it does not refuse others.
- Put="false": reorders within and drags out, but takes nothing in.
- Pull="BitSortablePull.None": reorders within and takes items in, but nothing drags out.
- Pull="BitSortablePull.Clone": reorders within and takes items in, and what drags out is a copy (see Clone).
- Disabled: none of these (see Disabled).
- A read-only list, such as an array, behaves as if it had Sort="false", Put="false" and a Pull of None - except that a Clone pull still copies from it.
- Try it: drag Pick 1 down its list - nothing moves; drag it into Target - it goes; drag it back - the first list does not take it. Drag Gym into Pinned: it goes in, and now it stays there.
Pick from (no Sort, no Put)
Pick 1
Pick 2
Pick 3
To pick up the item, press Space or Enter. While it is picked up, the arrow keys move it, Home and End move it to the start or the end of its list, Space or Enter drops it, and Escape puts it back.
Pinned (Pull None)
Rent
Groceries
To pick up the item, press Space or Enter. While it is picked up, the arrow keys move it, Home and End move it to the start or the end of its list, Space or Enter drops it, and Escape puts it back.
Target
Gym
Books
To pick up the item, press Space or Enter. While it is picked up, the arrow keys move it, Home and End move it to the start or the end of its list, Space or Enter drops it, and Escape puts it back.
Disabled
A Disabled list takes part in no drag: its items cannot be picked up - by the mouse, a finger or the
keyboard - and nothing is dropped into it. Its items are no longer a tab stop, and its root carries the bit-dis
class, the one hook for a disabled component. What its items render stays live. Use it to lock a list while,
say, its contents are being saved; to lock single items instead, see Filter.
Archive
2024 report
2025 report
Desk
Draft
Notes
To pick up the item, press Space or Enter. While it is picked up, the arrow keys move it, Home and End move it to the start or the end of its list, Space or Enter drops it, and Escape puts it back.
Handle
Handle is the CSS selector of a drag handle inside each item. Only the handle starts a drag, and the rest of
the item keeps its own pointer behavior - its text can be selected, its inputs typed into, its buttons clicked;
here a checkbox that is checked with a click. A tick travels with its step, since it lives in the item.
- With a Handle the items render as not draggable; pressing an element that matches the selector makes its item draggable for the drag that follows. The root gets the bit-srt-hnd class, which takes the grab cursor and the no-select rule off the rest of the item, so give the handle a grab cursor of its own (this page's handle class does).
- From the keyboard nothing changes: Tab reaches the item (not the control inside it) and Space picks it up, while keys pressed inside a control are the control's. For a handle a keyboard user reaches as well, make it a button type="button" with an accessible name: it picks its item up too.
- On a touch screen a handle still needs the long press, unless TouchDelay is 0 and the handle has touch-action: none (see Touch & pen).
- A handle belongs to the item it sits in: in nested lists, a handle of an inner item never drags the outer item around it. A selector that is not valid CSS breaks nothing: the script warns once in the console, and no item drags.
To pick up the item, press Space or Enter. While it is picked up, the arrow keys move it, Home and End move it to the start or the end of its list, Space or Enter drops it, and Escape puts it back.
Steps: Pack the tent, Check the weather (done), Fill the water bottles, Charge the torch
Filter
Filter is asked about every item, and an item it returns true for cannot be picked up - by the mouse, a
finger or the keyboard. It does not pin the item to its index: the other items can still be dragged past it, which
shifts it along by one, as in SortableJS. Here it reads a flag of the task, which the button of the task toggles; a
click on a control inside an item is the control's, and never starts a drag.
- Filter is a predicate on the typed item, not a CSS selector as in SortableJS, so the rule lives next to the data it reads, and a lock follows the data.
- A locked item gets the not-allowed cursor and the Filtered part (Classes.Filtered, Styles.Filtered). It is not dimmed by default, since its content stays live; --bit-Sortable-filtered-opacity fades it.
- From the keyboard, Space on a locked item announces the Locked text of the strings ("Release notes cannot be moved.").
- It locks an item against the user's drags only: a move made by code (MoveAsync, MoveToAsync) still moves it, and in a MultiDrag list a locked item cannot be selected. To lock a whole list, see Disabled.
Write the tests
Release notes
Deploy
Announce
To pick up the item, press Space or Enter. While it is picked up, the arrow keys move it, Home and End move it to the start or the end of its list, Space or Enter drops it, and Escape puts it back.
Feedback
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.