Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Menubar

A horizontal bar of menus, like a desktop application's menu bar.

Installation

npx logic2b@next add menubar

Usage

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

<Menubar>
  <MenubarMenu>
    <MenubarTrigger>File</MenubarTrigger>
    <MenubarContent>
      <MenubarItem>New Tab</MenubarItem>
      <MenubarItem>New Window</MenubarItem>
    </MenubarContent>
  </MenubarMenu>
</Menubar>

Examples

Checkboxes and radios

Accessibility

Built on Radix Menubar, which follows the WAI-ARIA menubar pattern.

  • Arrow keys move focus between menus and items; Enter or Space activates the focused item.
  • Esc closes the open menu and returns focus to its trigger.
  • Typeahead lets you jump to an item by typing its label.
  • Checkbox and radio items expose the correct role and checked state to assistive technology.

Live playground

Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.

Generated JSX
<Menubar
  className="w-fit"
  aria-label="Project menu"
>
  <MenubarMenu>
    <MenubarTrigger>Project</MenubarTrigger>
    <MenubarContent>
      <MenubarItem>New project</MenubarItem>
      <MenubarItem>Open…</MenubarItem>
      <MenubarSeparator />
      <MenubarItem>Export</MenubarItem>
    </MenubarContent>
  </MenubarMenu>
  <MenubarMenu>
    <MenubarTrigger>Help</MenubarTrigger>
    <MenubarContent>
      <MenubarItem>Documentation</MenubarItem>
      <MenubarItem>Keyboard shortcuts</MenubarItem>
    </MenubarContent>
  </MenubarMenu>
</Menubar>

API reference

Generated from the public TypeScript exports in src/ui/menubar.tsx.

View JSON

Menubar

Component
Props: React.ComponentProps<typeof MenubarPrimitive.Root>

MenubarPortal

Component
Props: React.ComponentProps<typeof MenubarPrimitive.Portal>

MenubarMenu

Component
Props: React.ComponentProps<typeof MenubarPrimitive.Menu>

MenubarTrigger

Component
Props: React.ComponentProps<typeof MenubarPrimitive.Trigger>

MenubarContent

Component
Props: React.ComponentProps<typeof MenubarPrimitive.Content>
PropTypeRequiredDefaultDescription
align"center" | "end" | "start"No"start"—
alignOffsetnumberNo-4—
sideOffsetnumberNo8—

MenubarGroup

Component
Props: React.ComponentProps<typeof MenubarPrimitive.Group>

MenubarSeparator

Component
Props: React.ComponentProps<typeof MenubarPrimitive.Separator>

MenubarLabel

Component
Props: React.ComponentProps<typeof MenubarPrimitive.Label> & { inset?: boolean }
PropTypeRequiredDefaultDescription
insetbooleanNo——

MenubarItem

Component
Props: React.ComponentProps<typeof MenubarPrimitive.Item> & { inset?: boolean variant?: "default" | "destructive" }
PropTypeRequiredDefaultDescription
insetbooleanNo——
variant"default" | "destructive"No"default"—

MenubarShortcut

Component
Props: React.ComponentProps<"span">

MenubarCheckboxItem

Component
Props: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>

MenubarRadioGroup

Component
Props: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>

MenubarRadioItem

Component
Props: React.ComponentProps<typeof MenubarPrimitive.RadioItem>

MenubarSub

Component
Props: React.ComponentProps<typeof MenubarPrimitive.Sub>

MenubarSubTrigger

Component
Props: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & { inset?: boolean }
PropTypeRequiredDefaultDescription
insetbooleanNo——

MenubarSubContent

Component
Props: React.ComponentProps<typeof MenubarPrimitive.SubContent>

Accessibility contract

Machine-readable behavior and consumer responsibilities for menubar.

View JSON
Support
Primitive-managed
Pattern
menubar
Radix Menubar
Keyboard interactions for menubar
KeysBehavior
ArrowUp ArrowDown ArrowLeft ArrowRightMove within the composite control.
Enter SpaceActivate the focused control.
EscapeClose the open surface and restore focus.

Built-in semantics

  • Manages menubar/menu/menuitem roles and roving focus across top-level menus.

Consumer responsibilities

  • Use it for application commands, not site navigation, and label icon-only items.