Repository navigation
useSortable: a headless hook for drag-and-drop reordering (lists and boards) #929
akashvekariya
started this conversation in
Suggestions
Replies: 1 comment
|
Opened #930 as a small draft PR for the hook, so the code is easier to review. Happy to adjust the name, API or scope. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi! I built a headless
useSortablehook for coss ui and wanted to check whether you would want it before opening a PR.What it is
A hook with no new dependency and no visuals of its own. It adds drag and drop reordering to a list, or to several lists at once, such as the columns of a board. You spread its props on your own elements, so it works with Card, Badge and the rest.
canMoveto refuse a move (for example a full column), with adata-drop-refusedattribute for stylingWhy
There has been interest in drag and drop and boards (#365, #393), and coss ui has no drag primitive yet. A small hook felt like the smallest piece that fits the library, rather than a full Kanban component.
Screen.Recording.2026-11-23.at.4.34.33.PM.mov
Code
Question
Would you take this? If yes, I will open one focused PR for the hook first, and the particles only afterwards if you want them. Happy to change the name, API or scope to fit how you would like it.
All reactions