# contextMenu

## Methods <a href="#z1a5y" id="z1a5y"></a>

## open(menuItems) <a href="#tkp0d" id="tkp0d"></a>

Pops up the right-click menu.

* `menuItems` : [MenuItem](https://www.electronjs.org/docs/latest/api/menu-item)
  * `id` string - Menu item ID
  * `label` string - Text displayed for the menu item
  * `submenu` \[MenuItem] - Submenu

```javascript
eagle.contextMenu.open([
    {
        id: "edit",
        label: "Edit",
        submenu: [
            {
                id: "resize",
                label: "Resize",
                click: () => { alert("Image resized") }
            },
            {
                id: "crop",
                label: "Crop",
                click: () => { alert("Image cropped") }
            },
            {
                id: "rotate",
                label: "Rotate",
                click: () => { alert("Image rotated") }
            }
        ]
    },
    {
        id: "effects",
        label: "Effects",
        submenu: [
            {
                id: "grayscale",
                label: "Grayscale",
                click: () => { alert("Grayscale effect applied") }
            },
            {
                id: "sepia",
                label: "Sepia",
                click: () => { alert("Sepia effect applied") }
            },
            {
                id: "invert",
                label: "Invert Colors",
                click: () => { alert("Color inversion applied") }
            }
        ]
    },
    {
        id: "export",
        label: "Export",
        click: () => { alert("Image exported") }
    }
])
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.eagle.cool/plugin-api/api/context-menu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
