📄 primereact/menu

File: menu.md | Updated: 11/15/2025

Source: https://primereact.org/menu/

Introducing PrimeReact v11 Alpha 🥁Learn More

Menu

Menu is a navigation/command component that supports dynamic and static positioning.

Import#


import { Menu } from 'primereact/menu';
         

Copy

Basic#


Menu requires a collection of menuitems as its model.

Copy

Group#


Copy

Popup#


Popup mode is enabled by adding popup property and calling toggle method with an event of the target. The popupAlignment property allows you to control how the overlay is aligned with its target.

Show LeftShow Right

<Toast ref={toast}></Toast>
<Menu model={items} popup ref={menuLeft} id="popup_menu_left" />
<Button label="Show Left" icon="pi pi-align-left" className="mr-2" onClick={(event) => menuLeft.current.toggle(event)} aria-controls="popup_menu_left" aria-haspopup />
<Menu model={items} popup ref={menuRight} id="popup_menu_right" popupAlignment="right" />
<Button label="Show Right" icon="pi pi-align-right" className="mr-2" onClick={(event) => menuRight.current.toggle(event)} aria-controls="popup_menu_right" aria-haspopup />
 

Copy

Template#


Custom content can be placed inside the menuitem using the template property.

  • PRIMEAPP

  • Documents

  • New⌘+N

  • Search⌘+S

  • Profile

  • Settings⌘+O

  • Messages2

  • Logout⌘+Q

  • avatar

    Amy ElsnerAgent

    <Menu model={items} className="w-full md:w-15rem" />

Copy

Command#


The command property defines the callback to run when an item is activated by click or a key event.

  • New

  • Search

    <Menu model={items} /> <Toast ref={toast} />

Copy

Router#


Items with navigation are defined with command and url property to be able to use a router link component, an external link or programmatic navigation.

Copy

Accessibility#


Screen Reader

Menu component uses the menu role and the value to describe the menu can either be provided with aria-labelledby or aria-label props. Each list item has a presentation role whereas anchor elements have a menuitem role with aria-label referring to the label of the item and aria-disabled defined if the item is disabled. A submenu within a Menu uses the group role with an aria-labelledby defined as the id of the submenu root menuitem label.

In popup mode, the component implicitly manages the aria-expanded, aria-haspopup and aria-controls attributes of the target element to define the relation between the target and the popup.

Keyboard Support

| Key | Function | | --- | --- | | tab | Add focus to the first item if focus moves in to the menu. If the focus is already within the menu, focus moves to the next focusable item in the page tab sequence. | | shift + tab | Add focus to the last item if focus moves in to the menu. If the focus is already within the menu, focus moves to the previous focusable item in the page tab sequence. | | enter | Activates the focused menuitem. If menu is in overlay mode, popup gets closes and focus moves to target. | | space | Activates the focused menuitem. If menu is in overlay mode, popup gets closes and focus moves to target. | | escape | If menu is in overlay mode, popup gets closes and focus moves to target. | | down arrow | Moves focus to the next menuitem. | | up arrow | Moves focus to the previous menuitem. | | home | Moves focus to the first menuitem. | | end | Moves focus to the last menuitem. |

  • Import

  • Basic

  • Group

  • Popup

  • Template

  • Command

  • Router

  • Accessibility

PrimeReact 10.9.7 by PrimeTek