Components

Menu

A button that opens a menu of actions, with support for submenus and horizontal menubars.

Usage

import { Menu } from "monochrome/react"

<Menu.Root>
  <Menu.Trigger>Account</Menu.Trigger>
  <Menu.Popover>
    <Menu.Label>Settings</Menu.Label>
    <Menu.Item>Profile</Menu.Item>
    <Menu.Item>Preferences</Menu.Item>
    <Menu.Separator />
    <Menu.Item>Sign Out</Menu.Item>
  </Menu.Popover>
</Menu.Root>

Examples

Disabled Items

Disabled items are skipped during keyboard navigation.

<Menu.Root>
  <Menu.Trigger>Actions</Menu.Trigger>
  <Menu.Popover>
    <Menu.Item>Edit</Menu.Item>
    <Menu.Item disabled>Delete</Menu.Item>
  </Menu.Popover>
</Menu.Root>

Checkbox and Radio Items

Use CheckboxItem for togglable options and RadioItem for single-select groups. These items stay open after interaction so users can make multiple selections.

<Menu.Root>
  <Menu.Trigger>Format</Menu.Trigger>
  <Menu.Popover>
    <Menu.CheckboxItem checked>Bold</Menu.CheckboxItem>
    <Menu.CheckboxItem checked={false}>Italic</Menu.CheckboxItem>
    <Menu.Separator />
    <Menu.RadioItem checked>Small</Menu.RadioItem>
    <Menu.RadioItem checked={false}>Medium</Menu.RadioItem>
    <Menu.RadioItem checked={false}>Large</Menu.RadioItem>
  </Menu.Popover>
</Menu.Root>

Nest a Menu.Group inside a Menu.Popover to create submenus. Toggle alignment and the safe zone debug triangle to see how pointer tracking works across menu levels.

A horizontal bar of dropdown menus for application-style navigation. Pass the menubar prop to enable menubar mode.

import { Menu } from "monochrome/react"

<Menu.Root menubar>
  <Menu.Popover>
    <Menu.Group>
      <Menu.Trigger>File</Menu.Trigger>
      <Menu.Popover>
        <Menu.Item>New File</Menu.Item>
        <Menu.Item>Save</Menu.Item>
      </Menu.Popover>
    </Menu.Group>
    <Menu.Group>
      <Menu.Trigger>Edit</Menu.Trigger>
      <Menu.Popover>
        <Menu.Item>Undo</Menu.Item>
        <Menu.Item>Redo</Menu.Item>
      </Menu.Popover>
    </Menu.Group>
  </Menu.Popover>
</Menu.Root>
AspectDropdownMenubar
StructureMenu.Root with Menu.Trigger + Menu.PopoverMenu.Root with menubar prop, Menu.Popover containing Menu.Groups
ActivationClick to openClick first, then hover switches
Arrow KeysUp/Down navigate itemsLeft/Right switch menus
Rolerole="menu"role="menubar"

Accessibility

Follows the WAI-ARIA Menu Button Pattern and WAI-ARIA Menu Bar Pattern.

Keyboard

KeyAction
Enter / SpaceOpen menu, activate item, or toggle checkbox/radio
Arrow DownMove focus to next item
Arrow UpMove focus to previous item
Arrow RightOpen submenu, or move to next menu (menubar)
Arrow LeftClose submenu, or move to previous menu (menubar)
HomeMove focus to first item
EndMove focus to last item
EscapeClose menu and return focus to trigger
a - zCyclic typeahead, focus next item starting with that letter

Disabled items and separators are skipped during keyboard navigation. Checkbox and radio items toggle on click or Enter/Space without closing the menu. In menubar mode, hovering over other triggers automatically switches menus after the first click.

API Reference

HTML

ElementAttributesDescription
Rootid="mcr:menu:*"Root ID (required)
Triggerid="mct:menu:*"Trigger ID (required)
aria-controlsMenu list ID
aria-expanded"true" or "false"
aria-haspopup="menu"Indicates menu popup
Menu listrole="menu"Menu container
id="mcc:menu:*"Menu ID (required)
aria-labelledbyTrigger element ID
aria-hidden"true" or "false"
popover="manual"Popover behavior
Menu itemrole="menuitem"Menu item
tabindex="-1"Focus managed programmatically
aria-disabled="true"For disabled items
Checkbox itemrole="menuitemcheckbox"Togglable menu item
aria-checked"true" or "false"
Radio itemrole="menuitemradio"Single-select menu item
aria-checked"true" or "false"
Separatorrole="separator"Visual divider between groups
Labelrole="presentation"Non-interactive section title
Menubarrole="menubar"Horizontal menu structure
Trigger tabindex0 for first, -1 for others

React

All components accept className for styling.

The root container.

PropTypeDefaultDescription
menubarbooleanfalseEnable menubar mode for horizontal menu bars

The button that opens the dropdown.

The container for menu items. Uses the Popover API. In menubar mode, renders as a <ul role="menubar">.

PropTypeDefaultDescription
disabledbooleanfalseWhether the item is disabled (renders as <span>)
hrefstringURL for link items (renders as <a>)

A togglable menu item. Clicking toggles aria-checked between "true" and "false". The menu stays open after interaction.

PropTypeDefaultDescription
checkedbooleanfalseWhether the item is checked
disabledbooleanfalseWhether the item is disabled (renders as <span>)

A single-select menu item. Clicking checks the item and unchecks others in the same implicit group. The menu stays open after interaction. Radio groups are determined by DOM position. Consecutive radio items form a group, separated by non-radio items (separators, labels, regular items).

PropTypeDefaultDescription
checkedbooleanfalseWhether the item is checked
disabledbooleanfalseWhether the item is disabled (renders as <span>)

A visual divider between menu item groups. Skipped during keyboard navigation.

A non-interactive section title within a menu. Renders as <li role="presentation">. Skipped during keyboard navigation.

Container for nested submenus. Contains a Menu.Trigger and Menu.Popover.

Frequently Asked Questions