Skip to Content
API ReferenceContextMenu

ContextMenu

A floating menu that appears at a given screen position and displays a list of ContextMenuItem entries. Attaches directly to the root container like Modal, rendered with absolute positioning at X, Y. Tapping any item or the backdrop dismisses the menu via OnDismiss.

Constructor

ContextMenu

Creates a ContextMenu.

ParameterDescription
itemsMenu items. Must not be null or empty.
xHorizontal anchor position in logical pixels.
yVertical anchor position in logical pixels.
onDismissCallback invoked when dismissal is requested. Must not be null.
keyAn optional key for reconciliation identity.

Properties

Items

The menu items to display. Must not be null or empty.

OnDismiss

Callback invoked when the menu requests dismissal — after an item tap or a backdrop tap. The caller is responsible for removing the ContextMenu from the tree in response.

X

Horizontal position in logical pixels from the left of the root container.

Y

Vertical position in logical pixels from the top of the root container.

Last updated on