Components / FloatingPanel
FloatingPanel
Glowing sphere in a corner that opens a panel over the app and drags between corners.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn floating_panel() -> impl View {
/// Keeps whether it is open, here while the page rebuilds.
struct Corner;
impl View for Corner {
fn build(&self, cx: &mut BuildCx<'_>) -> NodeId {
let open = cx.use_state(|| false);
// `.movable` and `.minimized` take bindings, for the app to remember them.
cx.child(&FloatingPanel::new(open.binding(), "Assistant", || {
Box::new(Text::new("The app stays usable behind this panel."))
}))
}
}
Corner
}