@dxos/react-ui-list
    Preparing search index...

    Type Alias UseReorderListOptions<T>

    type UseReorderListOptions<T> = {
        axis?: ReorderAxis;
        canDrop?: (args: { source: ElementDragPayload }) => boolean;
        dragPreview?: "clone" | ((item: T, source: HTMLElement) => ReactNode);
        getId: (item: T) => string;
        getInitialData?: (item: T, index: number) => Record<string, unknown>;
        items: readonly T[];
        onMove: (fromIndex: number, toIndex: number) => void;
        readonly?: boolean;
    }

    Type Parameters

    • T
    Index

    Properties

    Drop axis. Defaults to 'vertical'.

    canDrop?: (args: { source: ElementDragPayload }) => boolean

    Overrides the default canDrop (which matches payloads tagged with this list's id).

    dragPreview?: "clone" | ((item: T, source: HTMLElement) => ReactNode)

    The native drag preview: 'clone' snapshots the row itself into a detached container, a renderer draws something else for the item. Either replaces the browser's own image, which for a row in a scrolling column can take the preceding siblings along. The renderer also receives the dragged row, so a portalled preview can copy its scope (e.g. DragPreview source).

    getId: (item: T) => string

    Stable identifier per item. The monitor uses this to find source/target indices.

    getInitialData?: (item: T, index: number) => Record<string, unknown>

    Forwarded to pragmatic-dnd's getInitialData on each draggable.

    items: readonly T[]

    Authoritative item list. Read on each drop to compute the new index.

    onMove: (fromIndex: number, toIndex: number) => void

    Called with (fromIndex, toIndex) when a drop completes inside this list.

    readonly?: boolean

    When true, drag handles report as disabled. Defaults to false.