5 ms·
There is an htmx demo on drag-and-drop (in the reorder sense) using Sortable.js here: https://htmx.org/examples/sortable/ https://htmx.org/examples/sortable/
by recursivedoubts 2y ago
There is an htmx demo on drag-and-drop (in the reorder sense) using Sortable.js here:
https://htmx.org/examples/sortable/ https://htmx.org/examples/sortable/
Like most of the examples on the htmx site it is pretty bare bones (we keep it that way to focus on the concepts) but it's a reasonable demonstration of the integration. Whether that is good enough of course depends on your use case
If you want an integrated and polished ecosystem that's something htmx isn't going to provide: it's a library focused (mainly) on one thing: generalizing hypermedia controls. So, when you want client side functionality like this, you are going to have to glue things together a bit. I completely understand the desire of having an integrated ecosystem to avoid doing that.
- hencq 2y agoThanks! That actually seems very smooth. Trying out htmx has been high on my list for a while when I finally get time to do a little personal side project. Real life keeps getting in the way, but this is a good nudge. The appealing thing about htmx to me is that it seems like it should be very easy to keep everything in your head.
- mthoms 2y agoDoes it support nesting?
- recursivedoubts 2y agohere htmx is integrating with Sortable.js for drag and drop functionality via events, so whatever Sortable can do, htmx can respond to: http://sortablejs.github.io/Sortable/ http://sortablejs.github.io/Sortable/
- mthoms 2y agoI'm kinda familiar with Sortable, but haven't looked at it in the past several years. I'll have a look again, thanks!
- spirobelv2 2y agoafter having used both: sortablejs is better than reactdnd. that being said: htmx makes it too hard to quickly add a fat frontend to a page when necessary. The points about the react ecosystem are very valid, even if drag and drop is an exception. The network effects of react and others are hard to beat. Its probably even more npm as a whole than just react. wrote myself a framework with bun that solves this for me: https://github.com/spirobel/mininext https://github.com/spirobel/mininext still get the pure html+css feeling like with htmx, but can throw in a big frontend when needed. https://x.com/spirobel/status/1827231794934247674?t=moRzsWIPysnOcc6LeIYlQQ&s=19 https://x.com/spirobel/status/1827231794934247674?t=moRzsWIP...