Menubar

A horizontal menubar component for application-level navigation and actions.

Overview

The Menubar component displays a horizontal bar of menu triggers. Each trigger opens a Menu-style popup with checkbox items, radio items, submenus, keyboard navigation, and contextual surface behavior.

The bar itself lands at parent + 2. Menubar popup content stays on that bar surface, submenu content stays on the same parent popup surface, and highlighted items move one level above the popup surface.

Usage

import {
  Menubar,
  MenubarContent,
  MenubarItem,
  MenubarMenu,
  MenubarTrigger,
} from "@tilt-legal/cubitt-components/menubar";
<Menubar>
  <MenubarMenu>
    <MenubarTrigger>File</MenubarTrigger>
    <MenubarContent>
      <MenubarItem>New File</MenubarItem>
      <MenubarItem>Open File</MenubarItem>
    </MenubarContent>
  </MenubarMenu>
  <MenubarMenu>
    <MenubarTrigger>Edit</MenubarTrigger>
    <MenubarContent>
      <MenubarItem>Undo</MenubarItem>
      <MenubarItem>Redo</MenubarItem>
    </MenubarContent>
  </MenubarMenu>
</Menubar>

Examples

Basic

With Checkboxes

With Radio Group

With Submenu

With Groups

With Destructive Action

API Reference

The root container for the menubar.

PropTypeDescription
classNamestringAdditional CSS classes for the menubar.
orientationstringOrientation of the menubar. Defaults to "horizontal".
loopbooleanWhether keyboard navigation should loop.

A menu within the menubar.

PropTypeDescription
openbooleanWhether the menu is currently open (controlled).
defaultOpenbooleanWhether the menu is initially open (uncontrolled). Defaults to false.
onOpenChange(open: boolean, eventDetails) => voidCallback fired when the open state changes.

The trigger item for a menubar menu.

PropTypeDescription
classNamestringAdditional CSS classes for the trigger.
disabledbooleanWhether the trigger is disabled.

The popup container for menubar menu items. Content stays on the current menubar surface; submenu content stays on the parent popup surface.

PropTypeDescription
classNamestringAdditional CSS classes for the content.
align"start" | "center" | "end"Alignment relative to the trigger. Defaults to "start".
side"top" | "right" | "bottom" | "left"Which side of the trigger to position. Defaults to "bottom".
sideOffsetnumberDistance in pixels from the trigger. Defaults to 4.
alignOffsetnumberOffset in pixels along the alignment axis. Defaults to 0.

An individual selectable item in the menubar menu.

PropTypeDescription
classNamestringAdditional CSS classes for the item.
disabledbooleanWhether the item is disabled. Defaults to false.
variant"destructive"Visual variant for the item. Use "destructive" for delete actions.
insetbooleanWhether to add left padding for alignment with labelled items.
closeOnClickbooleanWhether to close the menu when clicked. Defaults to true.
onClickMouseEventHandlerClick handler for the item.

A menubar item with a checkbox.

PropTypeDescription
classNamestringAdditional CSS classes for the checkbox item.
checkedbooleanWhether the checkbox is checked.
onCheckedChange(checked: boolean) => voidCallback fired when the checked state changes.
disabledbooleanWhether the checkbox item is disabled.

A group of radio items where only one can be selected.

PropTypeDescription
valuestringThe value of the selected radio item.
onValueChange(value: string) => voidCallback fired when the selected value changes.

An individual radio item within a radio group.

PropTypeDescription
classNamestringAdditional CSS classes for the radio item.
valuestringThe value of this radio item. Required.
disabledbooleanWhether the radio item is disabled.

A label for a section of menubar items.

PropTypeDescription
classNamestringAdditional CSS classes for the label.
insetbooleanWhether to add left padding for alignment.

A visual separator between menubar items.

PropTypeDescription
classNamestringAdditional CSS classes for the separator.

Groups related menubar items together.

PropTypeDescription
classNamestringAdditional CSS classes for the group.

The root component for a submenu.

PropTypeDescription
openbooleanWhether the submenu is open (controlled).
defaultOpenbooleanWhether the submenu is initially open (uncontrolled).
onOpenChange(open: boolean) => voidCallback fired when the open state changes.
disabledbooleanWhether the submenu is disabled.

The trigger item for a submenu.

PropTypeDescription
classNamestringAdditional CSS classes for the submenu trigger.
insetbooleanWhether to add left padding for alignment.
disabledbooleanWhether the submenu trigger is disabled.

On this page