Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Draggable Sortable

Use DraggableSortable with DraggableSortableItem to add pointer, touch, and keyboard reordering to custom Admin Panel interfaces.

Import

1
import { DraggableSortable, DraggableSortableItem } from '@payloadcms/ui'

Basic usage

Loading component example…

DraggableSortable coordinates the list and reports the original and destination indexes through onDragEnd. Your component remains responsible for updating local state and persisting the new order when necessary.

Each DraggableSortableItem exposes the attributes, listeners, ref, transform, and transition needed to render an item. Apply the listeners to a visible drag handle so the rest of the row can retain its own interactions.

DraggableSortable props

Prop

Type

Description

children*

ReactNode

Renders the sortable items.

ids*

string[]

Lists item IDs in their current display order.

onDragEnd*

({ moveFromIndex, moveToIndex, event }) => void

Handles a completed reorder.

onDragStart

({ id, event }) => void

Handles the beginning of a drag.

className

string

Adds a class to the sortable list container.

DraggableSortableItem props

Prop

Type

Description

id*

string

Matches an entry in the parent ids array.

children*

(sortableState) => ReactNode

Renders the item with its drag attributes and visual state.

disabled

boolean

Prevents the item from being reordered.

* An asterisk denotes that a prop is required.

Accessibility

  • Put the supplied attributes and listeners on a keyboard-focusable drag handle.
  • Give the handle an accessible name that identifies the item it moves.
  • Persist the resulting order only after onDragEnd supplies a valid destination.

These components configure their own drag-and-drop context and require no Payload providers.

Was this page helpful?

Next

Dropzone