npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-sortable-list.json --yesSortable list
ProA 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.
What an agent sees
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>
)}
/>
);
}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.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-sortable-list.json --yesAdd the Goop Sortable list to this project. The install steps are at https://goop.so/docs/install.mdUsage
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
| Option | Type | What it does |
|---|---|---|
| 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 }
- data-slot values (to select a part by): sortable-list, sortable-list-body, sortable-list-content, sortable-list-handle, sortable-list-item, sortable-list-overlay, sortable-list-row, sortable-list-status
Keyboard
| Key | What it does |
|---|---|
| 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
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| 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.