use fission::prelude::*;
let menu = ContextMenu::with_items([
ContextMenuEntry::Item(
ContextMenuItem::new(
"copy-link",
Text::new(TextContent::KeyWithFallback {
key: "menu.copy_link".into(),
fallback: "Copy link".into(),
}),
)
.on_select(copy_link),
),
]);
let widget: Widget = ContextMenuRegion::new(
Text::new("Right-click for actions"),
menu,
)
.id(WidgetId::explicit("example.context_menu"))
.into();
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
id | Option<WidgetId> | Stable owner identity for the region and popup state. | Use an explicit id for menus in dynamic lists. |
child | Widget | The visible subtree that can open the menu. | Any widget can be wrapped. |
menu | ContextMenu | The menu entries and visual configuration. | Items can contain arbitrary child widgets. |
enabled | bool | Whether secondary-click opens the menu. | Defaults to true. |
semantics | Option<Semantics> | Optional semantics for the menu region owner. | Fission sets context_menu = true when enabled. |