dioxus-dnd-kit 🦀
A flexible, performant, and layout-stable Drag-and-Drop library for Dioxus 0.7.
Developed to handle smooth reordering, even when using JIT-engines like Tailwind CSS. It avoids layout flickering by keeping the DOM structure stable during drag operations.
Features
- Layout Stability: No more jumping elements when an item is picked up.
- Tailwind Friendly: Handles dynamic style injections gracefully.
- High Performance: Uses
join_allfor batch rect measurements. - Customizable: Full control over handlers, overlays, and placeholders.
Installation
Add to your Cargo.toml:
[]
= "0.1.3"
Quick Start
use *;
use *;
Components
DraggableView
The root manager. Handles global mouse events and renders the DraggableOverlay.
Draggable
Wraps your items. It manages a placeholder to keep the list size consistent while an item is "floating".
DraggableHandler
A specific area to grab the item. Perfect if you only want a small icon to trigger the drag.
Droppable
The "brain" of the operation. It detects collisions and updates your items signal in real-time.
Advanced: Tailwind & Dynamic Rects
If you use the Tailwind Play CDN or dynamic styles that change element sizes, dioxus-dnd-kit is ready for it. It uses a MutationObserver internally (or you can trigger recalculate_rects) to ensure coordinates are always fresh.
Examples
Check the examples folder for more.
License
MIT or Apache-2.0