Skip to content

📝 Community Note The content on this page was generated with the assistance of AI and is pending a human review. While we've done our best to ensure accuracy, there may be discrepancies or areas that could be improved.

menu.xml Reference Documentation


The menu.xml file is an important configuration file in Magento 2 that defines the structure and content of menu items in your store. It is located in the etc/adminhtml directory of your module or theme. This file is used to create or modify menus in the Magento admin panel.

Menu Structure

The menu.xml file uses XML tags to define the structure of the menu. Each menu item is created as a <add> tag within the <menu> tag. Here is an example of a simple menu structure:

<add id="Vendor_Module::menu_item1"
title="Menu Item 1"
<add id="Vendor_Module::menu_item2"
title="Menu Item 2"

In this example, we have two menu items: "Menu Item 1" and "Menu Item 2".

  • The id attribute uniquely identifies each menu item. It follows the format Vendor_Module::menu_item_id, where Vendor_Module is the module name and menu_item_id is a unique identifier for the menu item.
  • The title attribute sets the display name of the menu item.
  • The module attribute specifies the module that owns the menu item.
  • The sortOrder attribute determines the order in which the menu items are displayed.
  • The parent attribute defines the parent menu item of the current menu item. The parent attribute value should be set to the id of the parent menu item.
  • The action attribute specifies the controller and action that will be executed when the menu item is clicked.
  • The resource attribute restricts access to the menu item based on user roles and permissions.

Menu Item Configuration

Each menu item can be further configured using additional XML tags within the <add> tag. Here are some commonly used configuration options:

ACL Resource

The <resource> tag is used to specify the ACL resource that controls access to the menu item. It is recommended to define a unique ACL resource for each menu item to manage user permissions effectively. For example:

<add id="Vendor_Module::menu_item3"
title="Menu Item 3"

Menu Item Icons

You can add icons to your menu items using the <add> tag's resource attribute. Magento 2 supports a wide range of icons provided by the Font Awesome library. For example:

<add id="Vendor_Module::menu_item4"
title="Menu Item 4"
<argument name="icon" xsi:type="string">fa-icon-name</argument>

Replace fa-icon-name with the desired Font Awesome icon class name.

Menu Item Submenus

You can create submenus by adding multiple levels of menu items. Each submenu is defined by adding a nested <add> tag within the parent menu item's <add> tag. For example:

<add id="Vendor_Module::menu_item5"
title="Menu Item 5"
<add id="Vendor_Module::menu_item6"
title="Menu Item 6"

In this example, "Menu Item 6" is a submenu of "Menu Item 5".


The menu.xml file is a crucial component in defining the structure and content of menus in the Magento admin panel. By understanding its structure and configuration options, you can create customized menus that fit your specific needs. Use the provided examples and code snippets as a reference to help you create and modify menu items effectively.