Skip to content

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.

Customization

Defaults for every list of a subtree through BitParams, styling every part of the list, and right-to-left layouts.

Cascading parameters

BitParams with a BitSortableParams sets the defaults of every sortable list inside it - put one around the app's router for app-wide defaults; a parameter of the list itself still wins (the second list has an EmptyText of its own). It carries Animation, Classes, Delay, DelayTolerance, EmptyText, ForceFallback, Keyboard, RevertOnSpill, Scroll, ScrollSensitivity, ScrollSpeed, Strings (the announcements in the app's language), Styles, SwapThreshold and TouchDelay (a longer long press), besides the parameters every component takes.

One
Two
Three
My own empty text.

Style & Class

Style and Class reach the root of the list, Styles and Classes its parts - the items, the drag states and the empty state - and ItemStyle gives each item an inline style of its own, the way ItemClass gives it a class. The drag states read the public --bit-Sortable-* variables, which inherit: set them on :root, on an ancestor, or on the Style of a list. The last two lists set the ghost, the picked-up item and outlines for the lists that take the drag.
  • Root: the list (bit-srt), with bit-dis while Disabled and bit-srt-hnd with a Handle.
  • Item: every item wrapper, and the drop placeholder.
  • Ghost: the item being dragged with a pointer, in its list, and the drop placeholder in another list.
  • Chosen: the item picked up - also from the keyboard, which wears only this one.
  • Drag: the preview that follows a finger, a pen or a ForceFallback mouse, placed above the page.
  • SwapTarget, Selected and Filtered: the swap target, the items of a multi-drag selection, and the items a Filter locks.
  • Empty: what an empty list shows.
  • While a drag runs the script also sets attributes to style, at no render cost: data-bit-srt-accepts on every list that takes the drag, data-bit-srt-over on the one under the pointer, data-bit-srt-refused on that one when it refused the position, and data-bit-srt-dragging on the html element, set to native, pointer or keyboard.
  • The stylesheet draws only these states, and leaves the look of the list and its items to the page.

Style & Class
Styled 1
Styled 2
Styled 3
Styles & Classes
Classy 1
Classy 2
Classy 3
ItemStyle
Ordinary
Important
Routine

Apple
Banana
Cherry
Fig
Grape

RTL

Use BitSortable in right-to-left (RTL). The list is measured in its own order, so dragging an item toward the left moves it forward - drag the first step to the far left and it becomes the last - and from the keyboard the left arrow moves it to the next place.

گام ۱
گام ۲
گام ۳
گام ۴
گام ۵
ترتیب: گام ۱، گام ۲، گام ۳، گام ۴، گام ۵

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.