---
title: "Sortable List"
description: "A list that people put in their own order, by drag with a mouse, touch, or keys. A Move menu on each row does the same with no drag."
url: https://gelatinui.com/components/sortable-list
markdown_url: https://gelatinui.com/components/sortable-list.md
access: free
install: "npx shadcn@latest add @gelatin-ui/sortable-list"
registry_item: https://gelatinui.com/r/sortable-list.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Sortable List

> A list that people put in their own order, by drag with a mouse, touch, or keys. A Move menu on each row does the same with no drag.

Page: https://gelatinui.com/components/sortable-list

## When to use it

Best for: One list that people put in order, by drag or by keys.

- Use it when the order is the value.
- Use `SortableListItemMoveMenu` for a way with no drag.
- Use `orientation="grid"` for widgets.

## When not to use it

- To move items between columns, use a [Kanban](https://gelatinui.com/components/kanban.md).
- For a nested list, use a [Tree](https://gelatinui.com/components/tree.md).

## Notes for agents

- The value is the list of item ids, in order.
- With `defaultValue`, render from the function child: `{(order) => order.map(...)}`.
- `onValueChange` runs once per finished move, with the new order.
- `locked` holds an item in place, and `disabled` lets others pass it.
- Give each item a `label`: the handle and the Move menu read it.
- On touch, hold a row with no handle for 250ms.
- `driverRef` drives a real drag from code (the `DragDriver` contract: `pickUp(at, id)`, `carry`, `drop`, `putBack`, in viewport px), for a staged scene, a tour, or a test.

## Anatomy

```text
SortableList
├─ SortableListItem (0..n)
├─ SortableListHandle (0..n)
├─ SortableListItemMoveMenu (0..n)
├─ SortableListItemMoveMenuTrigger (0..n)
└─ SortableListItemMoveMenuContent (0..n)
```

## API reference

### SortableList

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `readonly string[]` |  | The item ids in order (controlled). |
| `defaultValue` | `readonly string[]` | EMPTY_ORDER | The first order when the list owns it (uncontrolled). |
| `onValueChange` | `function` |  | Called once per finished move with the new order: at the drop of a drag (not on each step), and at once for a menu move. Not called for a cancel (Escape) or a drop in the same place. |
| `orientation` | `SortableOrientation` | "vertical" | `vertical` (default) and `horizontal` lock the drag to their axis; `grid` moves freely. |
| `variant` | `SortableVariant` | "plain" | `plain` (default): rows with no edge. `card`: separate rows with an edge. |
| `size` | `SortableSize` | "default" | The row height: `sm` 32px, `default` 40px, `lg` 48px. |
| `disabled` | `boolean` | false | No item can be lifted or moved. |
| `labels` | `Partial<SortableListLabels>` |  | The words of the list (the names, the menu, the key bar), merged over `SORTABLE_LIST_LABELS`. |
| `children` | `function \| ReactNode` |  | The items. With an uncontrolled list, render them from the order: `(order) => …`. |
| `driverRef` | `Ref<DragDriver<string> \| null>` |  | Drives a drag from code (`DragDriver`, an item id as the item): a staged scene, a tour, or a test lifts an item, carries it, and drops it through the same drag as a pointer, with the lift, the room the others make, and the drop flight. |

### SortableListItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` |  | The item id: one id of the list value. |
| `label` | `string` | id | The name on the handle and the Move menu. Default: the id. |
| `disabled` | `boolean` | false | The item cannot be lifted. Other items still move past it. |
| `locked` | `boolean` | false | The item cannot be lifted and holds its place: no item moves past it (a pinned row). The handle shows a lock in place of the grip. |

### SortableListHandle

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `lockedIcon` | `ReactNode` |  | The mark of a locked item, in place of the grip. Default: a lock (pass a pin for a pinned row). |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### SortableListItemMoveMenu

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | The parts: a `SortableListItemMoveMenuTrigger` and a `SortableListItemMoveMenuContent`. |

Also takes every prop of Base UI `Menu.Root`: https://base-ui.com/react/components/menu

### SortableListItemMoveMenuTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### SortableListItemMoveMenuContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `arrow` | `boolean` |  | Show an arrow that points at the trigger. The gap grows from 4px to 8px. |
| `backdrop` | `boolean` |  | Put a clear layer under the popup (Base UI `Menu.Backdrop`), for example to dim it. |
| `portalProps` | `Omit` |  | Other Base UI props of the inner parts. A `className` here adds to the component classes. |
| `positionerProps` | `PopupPartProps` |  |  |
| `backdropProps` | `PopupPartProps<MenuBackdropProps>` |  |  |
| `arrowProps` | `PopupPartProps<MenuArrowProps>` |  |  |
| `children` | `ReactNode` |  | More items after the moves (Rename, Remove), below a separator. |

Also takes every prop of Base UI `Menu.Popup`: https://base-ui.com/react/components/menu

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| SortableList | `sortable-list` |  |  |  |
| SortableListItem | `sortable-list-item` | `data-disabled`, `data-lifted`, `data-part` |  | `motion-timing` |
| SortableListHandle | `sortable-list-handle` | `data-dnd-dragging` |  |  |
| SortableListItemMoveMenu | `sortable-list-item-move-menu` |  |  |  |
| SortableListItemMoveMenuTrigger | `sortable-list-item-move-menu-trigger` |  |  |  |
| SortableListItemMoveMenuContent | `sortable-list-item-move-menu-content` |  |  |  |

## Usage

Render the rows from the order that the list owns.

```tsx title="stage-order.tsx"
import { SortableList, SortableListHandle, SortableListItem } from "@/components/ui/sortable-list";

const stages = ["Lead", "Demo", "Won"];

export function StageOrder() {
  return (
    <SortableList defaultValue={stages}>
      {(order) => {
        return order.map((stage) => {
          return (
            <SortableListItem key={stage} value={stage} label={stage}>
              <SortableListHandle />
              {stage}
            </SortableListItem>
          );
        });
      }}
    </SortableList>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/sortable-list
```

It adds 45 registry items: 42 files, 6781 lines, and the npm packages `@base-ui/react`, `@dnd-kit/abstract`, `@dnd-kit/dom`, `@dnd-kit/react`, `@mantine/hooks`, `@phosphor-icons/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Menu](https://gelatinui.com/components/menu.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Kanban](https://gelatinui.com/components/kanban.md): Pick Kanban when people move cards between columns, such as the stages of work.
- [Tree](https://gelatinui.com/components/tree.md)
- [Table](https://gelatinui.com/components/table.md)
- [Data List](https://gelatinui.com/components/data-list.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Space | Lifts the focused item, and drops it. |
| Enter | Drops the lifted item. |
| Up Arrow, Down Arrow, Left Arrow, Right Arrow | Moves the lifted item. |
| Esc | Cancels the move. |

## Accessibility

Every move is also in the Move menu, with no drag.

The key bar (`DragKeyHint`) shows the keys during a keyboard drag.

The `label` names the handle.

## Motion

| Part | Motion |
| --- | --- |
| Others make room | panel · 260ms |
| Drop | sheet · 300ms |
