Installation
Add the following to your Cargo.toml:
[]
= "0.3.2"
dioxus-floating
A lightweight, high-performance floating positioning library for Dioxus 0.7.
Features
- Smart Placement: Automatic flip and shift logic.
- Scroll Awareness: Works perfectly inside
ScrollableView. - Portal Friendly: Designed to work with global layer managers.
- GPU Accelerated: Uses
translate3dfor buttery smooth performance.
Quick Start
use Rc;
use *;
use ;
Why ScrollableView?
ScrollableView is a required wrapper that provides a reactive context of the scrollable area. It tracks:
- Layout changes: Via
ResizeObserver. - Scroll offsets: Via
onscrollevent. - Async measurements: Provides a
reload()method for manual sync.
Context Menus
Use use_placement_on_point to anchor elements to mouse coordinates:
let click_pos = use_signal;
let placement = use_placement_on_point;
rsx!
Examples
The crate now includes standalone examples that mirror the real UI scenarios without depending on the workspace ui package:
dropdown: two FlyonUI-styled dropdowns with different trigger layouts and placements.context_menu: a right-click menu driven byuse_placement_on_point.
Status
This crate is in early development (v0.1.0). It was built out of necessity for a complex chat application and is currently "battle-tested" there. PRs and feedback are welcome!