---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Sortable list

A list of rows a person puts in order, by dragging a row's handle or by the keys (Space, the arrows, Space), each step said aloud, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `SortableList`.

## When to use

- A list of rows a person puts in order, by dragging a row's handle or by the keys (Space, the arrows, Space), each step said aloud.
- Use it wherever a person sets an order (steps, questions, priorities), never up and down buttons by hand. A list of Items in an order you set with handles beside them is the ItemReorderGroup; a list in a fixed order is a ListGroup or a Card of rows.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Sortable list on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-sortable-list.json --yes
```

```text
Add the Goop Sortable list to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { useState } from 'react';
import { SortableList } from '@/components/ui/goop/sortable-list';

function StudySteps() {
  const [steps, setSteps] = useState([
    { id: 'screener', label: 'Screener survey', length: '5 min' },
    { id: 'consent', label: 'Consent form', length: '2 min' },
    { id: 'interview', label: 'First interview', length: '45 min' },
  ]);
  return (
    <SortableList
      aria-label="Study steps"
      value={steps}
      onReorder={setSteps}
      renderItem={(step) => (
        <span className="flex items-center gap-2">
          <span className="min-w-0 flex-1 truncate">{step.label}</span>
          <span className="text-muted-foreground">{step.length}</span>
        </span>
      )}
    />
  );
}
```

- Fits: list, settings: collection (order: user).
- height, width, padding, gap, corner, background, shadow, text, motion: add no class for these.

## API reference

### Options

- `value?: readonly T[]` — The rows in their order, held in your state (with `onReorder`).
- `defaultValue?: readonly T[]` — The rows' first order, the list holding it from there.
- `onReorder?: (next: T[], move: SortableListMove<T>) => void` — Called after each drop that moved a row: the new order and the move.
- `renderItem?: (item: T, state: SortableListRowState) => ReactNode` — A row's content after its handle; the item's label in the row's words when left out.
- `itemLabel?: (item: T) => string` — A row's name, said as it moves and on its handle (default: its `label`, else its `id`).
- `messages?: Partial<SortableListMessages<T>>` — Your words for what is said while a row moves and for its handle.
- `disabled?: boolean = false` — No row may move.
- `aria-label?: string` — The list's name (`Study steps`), or `aria-labelledby`.
- `aria-labelledby?: string`

- Types: SortableListMove = { item: T; from: number; to: number }; SortableListRowState = { index: number; picked: boolean; dragging: boolean }

## Keyboard

- Tab: move to the next row's handle (each row's handle is its one tab stop; a picked-up row is put back first)
- ArrowUp / ArrowDown: at rest, move the focus to the handle above or below, past a disabled one; picked up, move the row one place
- Home / End: at rest, move the focus to the first or last handle; picked up, move the row to the top or the foot
- Space / Enter: pick the focused row up; again, drop it where it stands (said in the live region, onReorder called)
- Escape: picked up or dragged, put every row back where it was, the focus kept on the row's handle; a dialog round the list stays open

## Accessibility

- The part itself answers the keys above.
- hover, active: the browser's own (:hover, :active): write nothing
- dragging: the attribute data-dragging
- disabled: the prop disabled

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Tab bar](/themes/meadow/components/tab-bar): A phone screen's bottom navigation.
- [Tool call](/themes/meadow/components/tool-call): One tool call of an assistant's run, as a quiet row that opens onto its input and output.
- [Week calendar](/themes/meadow/components/week-calendar): A week of events by the hour, the days across and the hours down, with an all-day row.
- [Reply status](/themes/meadow/components/reply-status): The line an AI reply shows while it thinks and after it.
