Skip to main content

Module context_menu

Module context_menu 

Source
Expand description

Context Menu Component (shadcn/ui style)

Right-click context menus that reuse DropdownMenu internals. Opens on secondary click (right-click) and anchors to the cursor position.

use armas_basic::prelude::*;

let response = ui.allocate_response(egui::vec2(200.0, 100.0), egui::Sense::click());
let mut ctx_menu = ContextMenu::new("my_context_menu");
ctx_menu.show(ui.ctx(), &response, |menu| {
    menu.item("Cut").shortcut("⌘X");
    menu.item("Copy").shortcut("⌘C");
    menu.item("Paste").shortcut("⌘V");
    menu.separator();
    menu.item("Delete").destructive();
});

Structs§

ContextMenu
Context menu triggered by right-click on a region.
ContextMenuResponse
Context menu response