📄 primereact/megamenu

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

Source: https://primereact.org/megamenu/

Introducing PrimeReact v11 Alpha 🥁Learn More

MegaMenu

MegaMenu is navigation component that displays submenus together.

Import#


import { MegaMenu } from 'primereact/megamenu';
         

Copy

Basic#


MegaMenu requires a collection of menuitems as its model.

Copy

Vertical#


Layout of the MegaMenu is changed with the orientation property that accepts horizontal and vertical as options.

Copy

Template#


Custom content can be placed inside the megamenu using the start and end properties.

  • Company

    • FeaturesSubtext of item

    • CustomersSubtext of item

    • Case StudiesSubtext of item

    • SolutionsSubtext of item

    • FaqSubtext of item

    • LibrarySubtext of item

    • CommunitySubtext of item

    • RewardsSubtext of item

    • InvestorsSubtext of item

    • megamenu-demoBuild spectacular apps in no time.GET STARTED

  • Resources

  • Contact

avatar

<MegaMenu model={items} orientation="horizontal" start={start} end={end} breakpoint="960px" className="p-3 surface-0 shadow-2" style={{ borderRadius: '3rem' }} />
 

Copy

Command#


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

{
    label: 'Log out',
    icon: 'pi pi-signout',
    command: () => {
        // Callback to run
    }
}
         

Copy

Router#


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

{
    label: 'Log out',
    icon: 'pi pi-signout',
    url: 'https://www.react.dev/',
    command: () => {
        router.push('/installation');
    }
}
         

Copy

Accessibility#


Screen Reader

MegaMenu component uses the menubar role along with aria-orientation and the value to describe the component 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 MegaMenu uses the menu role with an aria-labelledby defined as the id of the submenu root menuitem label. In addition, root menuitems that open a submenu have aria-haspopup, aria-expanded and aria-controls to define the relation between the item and the submenu.

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 | If menuitem has a submenu, toggles the visibility of the submenu otherwise activates the menuitem and closes all open overlays. | | space | If menuitem has a submenu, toggles the visibility of the submenu otherwise activates the menuitem and closes all open overlays. | | escape | If focus is inside a popup submenu, closes the submenu and moves focus to the root item of the closed submenu. | | down arrow | If focus is on a root element, open a submenu and moves focus to the first element in the submenu otherwise moves focus to the next menuitem within the submenu. | | up arrow | If focus is on a root element, opens a submenu and moves focus to the last element in the submenu otherwise moves focus to the previous menuitem within the submenu. | | right arrow | If focus is on a root element, moves focus to the next menuitem. If the focus in inside a submenu, moves focus to the first menuitem of the next menu group. | | left arrow | If focus is on a root element, moves focus to the previous menuitem. If the focus in inside a submenu, moves focus to the first menuitem of the previous menu group. | | home | Moves focus to the first menuitem within the submenu. | | end | Moves focus to the last menuitem within the submenu. |

  • Import

  • Basic

  • Vertical

  • Template

  • Command

  • Router

  • Accessibility

PrimeReact 10.9.7 by PrimeTek