Skip to main content
Version: Next

Sortable API

import { Sortable } from '@editora/ui-react';

Props​

PropTypeDescription
allowFilteredDragboolean
allowNestingboolean
canDrop(info: SortableDropInfo) => booleanDecides whether items may go somewhere; return false to refuse. Asked on every pointer move, so keep it quick.
disabledboolean
dragHandleModeSortableDragHandleMode
dragHandleSelectorstring
dragPreviewSizeSortableDragPreviewSize
dropIndicatorVisibilitySortableDropIndicatorVisibility
dropzoneStyleSortableDropzoneStyle
filterQuerystring
groupstringSortables with the same group can exchange items: drop a card on another one and both report it (change's external). Ids must be unique across the group.
handleRadiusSortableRadius
hideToolbarboolean
itemRadiusSortableRadius
items (required)SortableItem[]
itemSpacingSortableSpace
labelsSortableLabels
listGapSortableSpace
listMaxHeightnumber | stringThe tallest the cards of a list can be before the list scrolls on its own: a number of px or a CSS length such as "20rem". A list's own maxHeight overrides it.
lists (required)SortableList[]
nestTriggerSortableNestTrigger
onBeforeChange(detail: SortableBeforeChangeDetail, event: Event) => boolean | voidCalled just before a move is applied, with the result it would have. Return false (or call event.preventDefault()) to cancel it: nothing changes and onChange does not fire.
onChange(detail: SortableChangeDetail) => void
onItemsChange(items: SortableItem[]) => void
onPersistRequest(detail: SortableChangeDetail) => void
onSelectionChange(detail: SortableSelectionChangeDetail) => void
pageStylesbooleanrenderItem / renderListHeader content is drawn inside the sortable's shadow root, where your CSS classes do not reach. pageStyles lets the page's stylesheets style it (they never override the sortable's own look).
persistKeystring
renderEmptyState(list: SortableList, context: SortableRenderEmptyStateContext) => React.ReactNode
renderItem(item: SortableItem, context: SortableRenderItemContext) => React.ReactNode
renderListHeader(list: SortableList, context: SortableRenderListHeaderContext) => React.ReactNode
selectionstring[]
showSelectionBadgeboolean
sortSortableSortMode
touchHoldDelaynumberMilliseconds a finger must rest on a card before it lifts (touch, dragging by the card). 0 lifts at once. Default 350.

Also accepts the standard HTML and React props of the element it renders (className, style, id, aria-*, data-*, event handlers).

Element: <ui-sortable>​

Sortable renders the ui-sortable custom element from @editora/ui-core, which can also be used without React.

Attributes: allow-filtered-drag, allow-nesting, custom-item-rendering, disabled, drag-handle-mode, drag-handle-selector, drag-preview-size, drop-indicator-visibility, dropzone-style, filter-query, group, hide-toolbar, items, labels, list-max-height, lists, nest-trigger, page-styles, persist-key, selection, show-selection-badge, sort, touch-hold-delay

Events: before-change, change, persist-request, selection-change