Add the Nook "Sortable list" component to this project, exactly as Nook ships it.
A reorderable list with touch-friendly handles, keyboard pickup, and spoken position updates.
Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add sortable-list`. It writes `components/ui/sortable-list.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/sortable-list.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:
```tsx
"use client";
import * as React from "react";
import { SortableList } from "@/components/ui/sortable-list";
import { Badge } from "@/components/ui/badge";
const initial = [
{ id: "brief", title: "Read the project brief", note: "Start with the problem we’re solving", time: "5 min" },
{ id: "research", title: "Review customer conversations", note: "Three interviews from last week", time: "20 min" },
{ id: "sketch", title: "Sketch the first direction", note: "A rough idea is enough", time: "30 min" },
{ id: "share", title: "Share with the team", note: "Leave room for a different perspective", time: "10 min" },
];
export default function SortableListDefault() {
const [items, setItems] = React.useState(initial);
return
Your focus queue
Drag a handle, or press Space and use the arrow keys.
item.id} getLabel={(item) => item.title} onReorder={setItems} renderItem={(item) => } /> ;
}
```
API
- `SortableList`: Own the items in your app and apply every onReorder result. Stable keys preserve focus. Interactive item content stays separate from the drag handle.
- `items, getKey` (`T[], (item: T) => string`): Ordered data and a stable, unique key for each item.
- `renderItem` (`(item: T, index: number) => ReactNode`): The content beside each handle.
- `getLabel` (`(item: T) => string`): Plain words used in handle names and announcements. Supply for meaningful labels.
- `onReorder` (`(items: T[]) => void`): Called for moves and cancellation. Replace the controlled items with this result.
- `disabled, emptyText` (`boolean, string`): Disable handles or replace the empty message.
- `SortControl`: A field select and descending toggle. Apply value.direction to the sorted table header’s aria-sort attribute.
- `fields` (`{ value: string; label: string }[]`): Fields the list or table can sort by.
- `value, defaultValue, onValueChange` (`SortValue, SortValue, (sort: SortValue) => void`): A field and direction (ascending or descending). Sorting the data is the caller’s responsibility.
Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: Space picks up a handle, arrows move it, Space drops it and Escape restores its order. Home and End move to either end. Polite announcements describe position. Pointer capture supports mouse, pen and touch without blocking scrolling outside the handle.
Done when the component renders like the example in light and dark mode and the project type-checks.