Introducing PrimeReact v11-alpha 🎉Discover Now

Menubar

Menubar coordinates multiple Menu instances horizontally with shared open state and keyboard navigation between triggers.

preview

Installation#

npx shadcn@latest add https://v11.primereact.org/r/menubar.json

Usage#

Menubar wraps any number of Menu instances. Each Menu keeps its own popup, and the Menubar coordinates which one is open, focus path between triggers, and hover-to-switch between them.

import { Menubar, MenubarTrigger } from '@/components/ui/menubar';
import { Menu, MenuGroup, MenuItem, MenuList, MenuPopup, MenuPortal, MenuPositioner, MenuSeparator } from '@/components/ui/menu';
<Menubar>
    <Menu>
        <MenubarTrigger>File</MenubarTrigger>
        <MenuPortal>
            <MenuPositioner sideOffset={4}>
                <MenuPopup>
                    <MenuList>
                        <MenuGroup>
                            <MenuItem>New File</MenuItem>
                            <MenuItem>Open…</MenuItem>
                        </MenuGroup>
                        <MenuSeparator />
                        <MenuGroup>
                            <MenuItem>Save</MenuItem>
                        </MenuGroup>
                    </MenuList>
                </MenuPopup>
            </MenuPositioner>
        </MenuPortal>
    </Menu>
 
    <Menu>
        <MenubarTrigger>Edit</MenubarTrigger>
        {/* ... */}
    </Menu>
</Menubar>

MenubarTrigger is a styled wrapper around Menu.Trigger — use it for triggers that sit inside a Menubar so they pick up bar-level styling and data-open highlighting.

Examples#

Basic#

A standard application menubar with File, Edit, View, Help menus.

basic-demo

With Submenus#

Each Menu inside the bar can contain MenuSub for nested levels.

submenu-demo

API#

Sub-components#

See Primitive API for Menubar props (orientation, loopFocus, modal, disabled).

MenubarTrigger is a thin wrapper around Menu.Trigger; the underlying API is identical — see Menu for trigger props.

Accessibility#

Screen Reader#

Menubar follows the WAI-ARIA Menubar pattern with role="menubar" and aria-orientation. Each MenubarTrigger exposes aria-haspopup="true" and aria-expanded to announce open/closed state to assistive technology.

Keyboard Support#

Triggers and items participate in roving focus across the bar.

KeyFunction
right arrow / left arrowMove focus to the next / previous trigger (loops by default).
home / endMove focus to the first / last trigger.
down arrow / enter / spaceOpen the focused trigger's menu and move focus to its first item.
up arrowOpen the focused trigger's menu and move focus to its last item.
escapeClose the open menu and return focus to its trigger.
Any printable characterWhile a menu is open, jump to the next item starting with the character.

When a menu is already open, hovering another trigger automatically switches the open menu to it.