Rows that nest into groups that open and close, and drag to reorder, as a site's navigation or a panel's list.
Installation
Examples
Default
items holds the rows and their children, and the function you pass as children draws each one. Each row is a List item, and label names it for its toggle and for the drag preview.
The arrow keys move between rows and open and close groups, and Enter or Space selects. Groups open and close as a Collapsible does, and find-in-page opens the one that holds a match.
In a panel
variant="list" draws rows as a panel's list, such as layers, with a line between each and each level set in. With onDrop, rows drag: a drop reaches it as the dragged id, the target row, and a position of before, after, or inside, and you move the item in your data. canDrag and canDrop add rules: here, the image stays last and only groups take layers. A touch drags after a short hold, so a swipe still scrolls.
Navigation
render draws a row as a link, such as Next.js's Link, so the arrow keys move between links and Enter follows one. This site's sidebar is one.
Anatomy
Each part's data-slot, which a theme styles, is beside it.
bun add @roprgm/ui