# AddMenuItem

## Introduction

The AddMenuItem function allows adding menu items to Gum. The AddMenuItem accepts an enumerable of strings which allow you to embed menu items under a root menu item.

## Code Example

The following shows how to create a menu item called "My Plugin" which contains two items: First and Second. Clicking each item results in a message box appearing. Add the following to your plugin's **StartUp** function.

```
// Add startup logic here:
var firstMenuItem = 
    AddMenuItem(new List<string> { "My Plugin", "First" });

firstMenuItem.Click += (args, sender) => 
    System.Windows.Forms.MessageBox.Show("You clicked first");

var secondMenuItem =
    AddMenuItem(new List<string> { "My Plugin", "Second" });

secondMenuItem.Click += (args, sender) =>
    System.Windows.Forms.MessageBox.Show("You clicked second");
```

![](/files/-Mb9SlRZE_HYmoLvXIKm)


---

# 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://docs.flatredball.com/gum/gum-tool/plugins/pluginbase.addmenuitem.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.
