Components / ContextMenu
ContextMenu
Menu opened at the pointer on right click.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn context_menu() -> impl View {
ContextMenu::new(
Text::new("Right-click in this box")
.foreground(Semantic::InkMuted)
.centered()
.height(90.0)
.background(Semantic::Control)
.corner_radius(12.0),
)
.item(MenuItem::new("Copy").icon(IconName::Copy).shortcut("⌘C"))
.item(MenuItem::new("Sort by").item(MenuItem::new("Name")).item(MenuItem::new("Date")))
.item(MenuItem::new("Delete").icon(IconName::Trash2).destructive())
}