Skip to content
Redpanda UI
Esc
↑↓navigate↵open⌘Jpreview
Made by shadcn
Edit on GitHub

Menubar

A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands.

Installation

bash
npx shadcn@latest add @redpanda/menubar
bash
pnpm dlx shadcn@latest add @redpanda/menubar
bash
yarn dlx shadcn@latest add @redpanda/menubar
bash
bunx shadcn@latest add @redpanda/menubar
bash
nubx shadcn@latest add @redpanda/menubar
bash
aube dlx shadcn@latest add @redpanda/menubar

When to use

The Menubar component provides persistent menu access similar to desktop applications. Use this decision tree to determine when it’s appropriate:

Usage

tsx
import {  Menubar,  MenubarContent,  MenubarItem,  MenubarMenu,  MenubarSeparator,  MenubarShortcut,  MenubarTrigger,} from '@/components/ui/menubar';
tsx
<Menubar>  <MenubarMenu>    <MenubarTrigger>File</MenubarTrigger>    <MenubarContent>      <MenubarItem>        New Tab <MenubarShortcut>⌘T</MenubarShortcut>      </MenubarItem>      <MenubarItem>New Window</MenubarItem>      <MenubarSeparator />      <MenubarItem>Share</MenubarItem>      <MenubarSeparator />      <MenubarItem>Print</MenubarItem>    </MenubarContent>  </MenubarMenu></Menubar>

Examples

Checkbox items

Radio items

Nested submenus

Props

Keyboard interactions

Key Action
Tab into the menubar Focus lands on the first top-level trigger.
ArrowLeft / ArrowRight Moves between top-level menus.
ArrowDown / Enter / Space Opens the focused menu and focuses its first item.
ArrowUp / ArrowDown (inside a menu) Moves between items.
ArrowLeft / ArrowRight (inside a menu) Opens / closes submenus and moves between adjacent menus.
Home / End Jumps to first / last item.
Enter / Space Activates the focused item.
Escape Closes the open menu.
Typing a character Typeahead jumps to the next matching item.

Accessibility

  • The menubar container has role="menubar" and each top-level trigger role="menuitem" with aria-haspopup="menu" and aria-expanded.
  • Focus is roving across both the menubar and each menu; only one trigger is in the tab order.
  • Keep labels short and single-level where possible. Deeply nested submenus are hard to reach for motor-impaired users — consider a DropdownMenu with keepMounted panels instead.
  • Open state lives on each child MenubarMenu (set open / onOpenChange there), not on the Menubar root.

Credits

  • We use Base UI for the menubar component.
  • We take our inspiration from Shadcn UI for the menubar style.

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.1.0Bulk install experience and Dialog polish.#119
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
See full history →

Last updated on

Was this page helpful?