Component guideEditable source

Menubar

A horizontal set of application menus with keyboard navigation.

Original component docs
On this page4 sectionsBack to top

Use Menubar for application commands such as File and View, not as the default navigation of a marketing site. Each MenubarMenu owns a trigger and content. Use Navigation Menu for page navigation.

Live preview
Loading preview...

#Installation

Complete the base setup. For manual installation:

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/menubar.json

#Usage

"use client";
import { useState } from "react";
import {
  Menubar,
  MenubarMenu,
  MenubarTrigger,
  MenubarContent,
  MenubarItem,
} from "@/components/ui/menubar";

export default function FileMenu() {
  const [message, setMessage] = useState("No command selected.");
  return (
    <div className="grid gap-3">
      <Menubar>
        <MenubarMenu>
          <MenubarTrigger>File</MenubarTrigger>
          <MenubarContent>
            <MenubarItem onClick={() => setMessage("Created a local draft.")}>
              New draft
            </MenubarItem>
            <MenubarItem disabled>Export</MenubarItem>
          </MenubarContent>
        </MenubarMenu>
      </Menubar>
      <p role="status">{message}</p>
    </div>
  );
}

#API reference

Prop / partPurposeDefault
Menubar.loopFocusWrap trigger keyboard navigationtrue
Menubar.modalLimit interaction to an open menutrue
Menubar.disabledDisable all menus in the barfalse
Menubar.orientationTrigger navigation axishorizontal
MenubarContent.align / sideOffsetPopup placementstart / 8
MenubarCheckboxItem.checked / onCheckedChangeChecked command stateUncontrolled
MenubarContent.alignOffsetPopup alignment adjustment, in pixels-4

#Accessibility

Keep labels short and commands meaningful. Arrow keys navigate triggers and menu items; Escape dismisses. MenubarShortcut only displays text: implement and test the corresponding keyboard handler separately. Make disabled commands visually identifiable, and do not use application-menu semantics for an ordinary list of website links.