sc1m/design
ComponentsMenubar

Menubar

Menubar component built on Base UI, styled with sc1m tokens.

StableBase UI

Live preview

Installation

pnpm dlx shadcn@latest add @sc1m/menubar

This also merges the token layer and installs src/lib/cn.ts plus @base-ui/react. For the manual route — prerequisites, components.json, and app-level setup — see Installation.

Usage

import {
  Menubar,
  MenubarMenu,
  MenubarTrigger,
  MenubarContent,
  MenubarItem,
  MenubarSeparator,
  MenubarGroup,
  MenubarGroupLabel,
} from "@/components/ui/menubar";

Composition

Every part is a separate export. Menubar owns state; the rest are presentational and must appear in this order.

Menubar└── MenubarMenu    ├── MenubarTrigger    └── MenubarContent        ├── MenubarItem        └── MenubarSeparator

Example

The preview above, with its source. This is the demo module verbatim, so the code and the thing it renders cannot drift apart.

<Menubar>
  <MenubarMenu>
    <MenubarTrigger>File</MenubarTrigger>
    <MenubarContent>
      <MenubarItem>New file</MenubarItem>
      <MenubarItem>Open...</MenubarItem>
      <MenubarSeparator />
      <MenubarItem>Save</MenubarItem>
    </MenubarContent>
  </MenubarMenu>
  <MenubarMenu>
    <MenubarTrigger>Edit</MenubarTrigger>
    <MenubarContent>
      <MenubarItem>Undo</MenubarItem>
      <MenubarItem>Redo</MenubarItem>
      <MenubarSeparator />
      <MenubarItem>Cut</MenubarItem>
      <MenubarItem>Copy</MenubarItem>
    </MenubarContent>
  </MenubarMenu>
  <MenubarMenu>
    <MenubarTrigger>View</MenubarTrigger>
    <MenubarContent>
      <MenubarItem>Zoom in</MenubarItem>
      <MenubarItem>Zoom out</MenubarItem>
    </MenubarContent>
  </MenubarMenu>
</Menubar>

API reference

Each part forwards every prop of its Base UI counterpart; the tables list the ones declared on the part itself. See Base UI's reference for the inherited element props.

PropTypeDefaultDescription
modalbooleantrueWhether the menubar is modal.
disabledbooleanfalseWhether the whole menubar is disabled.
orientationMenuRoot.Orientation'horizontal'The orientation of the menubar.
loopFocusbooleantrueWhether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys.

Accessibility

Behaviour, focus management, and ARIA wiring come from Base UI's Menubar — see its reference for the full keyboard map.

  • Disabled parts mute their contents rather than the element, keeping the focus ring at full strength where the part stays focusable.

Design tokens

The component reads semantic tokens only — no raw colour, radius, or duration appears in its source. Override the token, not the component.

TokenApplied to
--brand-radius-lgMenubar, MenubarContent
--brand-radius-smMenubarTrigger, MenubarItem
--fgMenubarContent
--fg-subtleMenubarGroupLabel
--lineMenubar, MenubarContent, MenubarSeparator
--shadow-overlayMenubarContent
--surfaceMenubarTrigger, MenubarItem
--surface-raisedMenubar, MenubarContent

Source

src/components/ui/menubar/menubar.tsx — no next/* imports, so it drops into any React 19 + Tailwind v4 app.