Menubar

A horizontal menubar component that displays multiple menu items in a bar, commonly used for application-level navigation and actions.

Overview

The Menubar component displays a horizontal bar of menu triggers, each opening a dropdown menu. Built on Base UI Menubar primitives, it supports checkboxes, radio groups, submenus, keyboard navigation, and fully customizable styling.

Usage

import {
  Menubar,
  MenubarMenu,
  MenubarTrigger,
  MenubarContent,
  MenubarItem,
} from "@tilt-legal/cubitt-components/primitives";
<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

A basic menubar with multiple menus.

With Checkboxes

Menubar items with checkbox controls.

With Radio Group

Menubar with radio group for mutually exclusive options.

With Submenu

Menubar with nested submenus.

With Groups

Menubar with grouped items and labels.

With Destructive Action

Menubar with destructive action styling.

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. Defaults to true.

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 button for a menubar menu.

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

The container for menu items, positioned relative to the trigger.

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 8.
alignOffsetnumberOffset in pixels along the alignment axis. Defaults to -4.

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 labeled 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.

Important: MenubarLabel must be used within a MenubarGroup component due to Base UI's context requirements.

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 button 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