Skip to content

Menu

Menu

A menu of actions (role="menu"), in one of two forms:

- **Static menu** โ€” Menu.Item/Menu.Divider children render inline inside the role="menu" element. The menu itself is not a tab stop: one item is (the last focused enabled item, else the first enabled one). When every item is disabled, the menu element holds the tab stop instead, so keyboard and screen-reader users still reach it. Arrow keys, Home/End and typeahead move between enabled items; Enter and Space activate the focused item (a Space typed within 500 ms of a typeahead character continues the search instead).
- **Popup menu** โ€” with Menu.Trigger and Menu.Popover children, or whenever open, defaultOpen or onOpenChange is passed (even false), the root renders no element of its own: the trigger opens the portaled Menu.Popover, item activation returns focus to the trigger and closes it (focus is on the trigger before the menu goes, so a Dialog the item opens returns focus there when it closes), unless persistOnItemClick (or the item's own persistOnClick) keeps it open. Open state is open/defaultOpen/onOpenChange. With openOnHover a mouse pointer resting on the trigger opens it without moving focus; with openOnContext the trigger is a context-menu region (a right click, Shift+F10 or the ContextMenu key opens the menu there).
- **Submenus** โ€” a <Menu> rendered in a menu list (inside Menu.Popover, or among the items of a static menu) is a submenu. Its Menu.Trigger wraps a Menu.Item, which becomes the submenu's trigger item (aria-haspopup="menu", a chevron that mirrors in RTL): tsx <Menu.Popover> <Menu> <Menu.Trigger><Menu.Item>Open recent</Menu.Item></Menu.Trigger> <Menu.Popover><Menu.Item>report.docx</Menu.Item></Menu.Popover> </Menu> </Menu.Popover> ArrowRight (ArrowLeft in RTL), Enter, Space, a click, or the mouse resting on the item opens the submenu (the keys and the click move focus to its first item); ArrowLeft (ArrowRight in RTL) and Escape close only that submenu and return focus to its item; item activation and Tab close every level and put focus on the root trigger (under a static menu, on the submenu's trigger item). One submenu of a menu is open at a time. It works in static menus too. A Menu inside a Popover or Dialog opened from an item is a root menu of its own, not a submenu. Menu.SplitGroup puts an action and the button of its submenu in one row.

**Checked values**: Menu.ItemCheckbox, Menu.ItemRadio and Menu.ItemSwitch are bound by name and value to the Menu's checkedValues (defaultCheckedValues, onCheckedValuesChange), in static and popup menus alike: unlike open, they do not make a Menu a popup menu. Space changes a checkable item and keeps the menu open; Enter and a click change it and close a popup menu. A submenu shares its parent's checked values unless it sets checkedValues or defaultCheckedValues of its own. Menu.Group and Menu.GroupHeader label a set of items; Menu.ItemLink navigates. The item labels line up: once an item of a menu shows a check or an icon, every item keeps that column.

**Popup detection**: Menu looks for Menu.Trigger/Menu.Popover (also under their flat names from a Server Component) among its direct children and inside Fragments only. When they are wrapped in another element or component, pass open, defaultOpen or onOpenChange to force popup mode; otherwise the static role="menu" element is rendered around them (development warning). A popup menu renders no root element, so className, ref and other DOM props on Menu are ignored (development warning): put them on Menu.Popover. Items rendered in a popup menu outside Menu.Popover have no role="menu" parent (development warning).

**Items of your own**: an element with role="menuitem" among the items is an item of the menu (arrow keys, typeahead and the pointer reach it). useMenuContext gives it close(), which closes the menu as a built-in item does, and useMenuListContext the icon and check columns that line its label up with the others.

Sub-components are also exported under flat names (MenuItem, MenuDivider, MenuTrigger, MenuPopover, MenuItemCheckbox, MenuItemRadio, MenuItemSwitch, MenuItemLink, MenuGroup, MenuGroupHeader, MenuSplitGroup): React Server Components import those, because dotted access (Menu.Item) needs a client file.

Examples

Default

export const Default: Story = {};

With Icons

export const WithIcons: Story = {
  args: {
    'aria-label': 'Edit',
    children: (
      <>
        <Menu.Item icon={{ children: 'โœ‚๏ธ' }}>Cut</Menu.Item>
        <Menu.Item icon={{ children: '๐Ÿ“‹' }}>Copy</Menu.Item>
        <Menu.Item icon={{ children: '๐Ÿ“Œ' }}>Paste</Menu.Item>
      </>
    ),
  },
};

With Disabled

export const WithDisabled: Story = {
  args: {
    'aria-label': 'Edit',
    children: (
      <>
        <Menu.Item>Undo</Menu.Item>
        <Menu.Item>Redo</Menu.Item>
        <Menu.Item disabled>Paste (empty clipboard)</Menu.Item>
      </>
    ),
  },
};

With Divider

export const WithDivider: Story = {
  args: {
    children: (
      <>
        <Menu.Item>New File</Menu.Item>
        <Menu.Item>Open File</Menu.Item>
        <Menu.Divider />
        <Menu.Item>Save</Menu.Item>
        <Menu.Item>Save As</Menu.Item>
        <Menu.Divider />
        <Menu.Item>Exit</Menu.Item>
      </>
    ),
  },
};

With Shortcuts

export const WithShortcuts: Story = {
  args: {
    children: (
      <>
        <Menu.Item shortcut="Ctrl+N">New File</Menu.Item>
        <Menu.Item shortcut="Ctrl+O">Open File</Menu.Item>
        <Menu.Divider />
        <Menu.Item shortcut="Ctrl+S">Save</Menu.Item>
        <Menu.Item shortcut="Ctrl+Shift+S">Save As</Menu.Item>
      </>
    ),
  },
};

With Trigger

export const WithTrigger: Story = {
  args: {
    'aria-label': undefined,
    onOpenChange: fn(),
    children: (
      <>
        <Menu.Trigger>
          <Button>Actions</Button>
        </Menu.Trigger>
        <Menu.Popover>
          <Menu.Item onClick={fn()} shortcut="Ctrl+E">
            Edit
          </Menu.Item>
          <Menu.Item onClick={fn()}>Duplicate</Menu.Item>
          <Menu.Divider />
          <Menu.Item disabled>Archive</Menu.Item>
          <Menu.Item onClick={fn()}>Delete</Menu.Item>
        </Menu.Popover>
      </>
    ),
  },
};

Long Menu

export const LongMenu: Story = {
  args: {
    'aria-label': undefined,
    onOpenChange: fn(),
    children: (
      <>
        <Menu.Trigger>
          <Button>Commands</Button>
        </Menu.Trigger>
        <Menu.Popover>
          {LONG_MENU_ITEMS.map((label) => (
            <Menu.Item key={label} onClick={fn()}>
              {label}
            </Menu.Item>
          ))}
        </Menu.Popover>
      </>
    ),
  },
};

Long Menu Max Height

export const LongMenuMaxHeight: Story = {
  args: {
    'aria-label': undefined,
    onOpenChange: fn(),
    children: (
      <>
        <Menu.Trigger>
          <Button>Commands</Button>
        </Menu.Trigger>
        <Menu.Popover className="max-h-64">
          {LONG_MENU_ITEMS.map((label) => (
            <Menu.Item key={label} onClick={fn()}>
              {label}
            </Menu.Item>
          ))}
        </Menu.Popover>
      </>
    ),
  },
};

Checkbox Items

export const CheckboxItems: Story = {
  args: {
    'aria-label': undefined,
    defaultCheckedValues: { view: ['ruler', 'status-bar'] },
    children: (
      <>
        <Menu.Trigger>
          <Button>View</Button>
        </Menu.Trigger>
        <Menu.Popover>{viewItems}</Menu.Popover>
      </>
    ),
  },
};

Radio Items

export const RadioItems: Story = {
  args: {
    'aria-label': undefined,
    defaultCheckedValues: { sort: ['modified'] },
    children: (
      <>
        <Menu.Trigger>
          <Button>Sort</Button>
        </Menu.Trigger>
        <Menu.Popover>
          <Menu.Group>
            <Menu.GroupHeader>Sort by</Menu.GroupHeader>
            {sortItems}
          </Menu.Group>
        </Menu.Popover>
      </>
    ),
  },
};

Switch Items

export const SwitchItems: Story = {
  args: {
    'aria-label': undefined,
    persistOnItemClick: true,
    defaultCheckedValues: { editor: ['autosave', 'word-wrap'] },
    children: (
      <>
        <Menu.Trigger>
          <Button>Editor settings</Button>
        </Menu.Trigger>
        <Menu.Popover>
          <Menu.ItemSwitch name="editor" value="autosave">
            Autosave
          </Menu.ItemSwitch>
          <Menu.ItemSwitch name="editor" value="word-wrap">
            Word wrap
          </Menu.ItemSwitch>
          <Menu.ItemSwitch name="editor" value="minimap">
            Minimap
          </Menu.ItemSwitch>
        </Menu.Popover>
      </>
    ),
  },
};

Mixed Columns

export const MixedColumns: Story = {
  args: {
    'aria-label': 'Format',
    defaultCheckedValues: { format: ['bold'] },
    children: (
      <>
        <Menu.ItemCheckbox name="format" value="bold" shortcut="Ctrl+B">
          Bold
        </Menu.ItemCheckbox>
        <Menu.ItemCheckbox name="format" value="italic" shortcut="Ctrl+I">
          Italic
        </Menu.ItemCheckbox>
        <Menu.Divider />
        <Menu.Item icon={{ children: 'โœ‚๏ธ' }} shortcut="Ctrl+X">
          Cut
        </Menu.Item>
        <Menu.Item icon={{ children: '๐Ÿ“‹' }} shortcut="Ctrl+C">
          Copy
        </Menu.Item>
        <Menu.Item shortcut="Ctrl+V">Paste</Menu.Item>
        <Menu.Divider />
        <Menu.ItemSwitch name="format" value="spellcheck">
          Check spelling
        </Menu.ItemSwitch>
      </>
    ),
  },
};

Static Checkable

export const StaticCheckable: Story = {
  args: {
    'aria-label': 'View options',
    defaultCheckedValues: { view: ['gridlines'], sort: ['name'] },
    children: (
      <>
        <Menu.Group aria-label="Show">{viewItems}</Menu.Group>
        <Menu.Divider />
        <Menu.Group>
          <Menu.GroupHeader>Sort by</Menu.GroupHeader>
          {sortItems}
        </Menu.Group>
      </>
    ),
  },
};

Controlled Checked Values

Showing: ruler. Sorted by: name.

export const ControlledCheckedValues: Story = {
  args: {
    'aria-label': 'View',
    children: (
      <>
        {viewItems}
        <Menu.Divider />
        <Menu.Group>
          <Menu.GroupHeader>Sort by</Menu.GroupHeader>
          {sortItems}
        </Menu.Group>
      </>
    ),
  },
  render: (args) => <ControlledViewMenu {...args} />,
};

Groups

export const Groups: Story = {
  args: {
    'aria-label': undefined,
    defaultCheckedValues: { view: ['ruler'], sort: ['name'] },
    children: (
      <>
        <Menu.Trigger>
          <Button>View</Button>
        </Menu.Trigger>
        <Menu.Popover>
          <Menu.Group>
            <Menu.GroupHeader>Show</Menu.GroupHeader>
            {viewItems}
          </Menu.Group>
          <Menu.Divider />
          <Menu.Group>
            <Menu.GroupHeader>Sort by</Menu.GroupHeader>
            {sortItems}
          </Menu.Group>
        </Menu.Popover>
      </>
    ),
  },
};
export const LinkItems: Story = {
  args: {
    'aria-label': undefined,
    children: (
      <>
        <Menu.Trigger>
          <Button>Account</Button>
        </Menu.Trigger>
        <Menu.Popover>
          <Menu.ItemLink href="#profile">Profile</Menu.ItemLink>
          <Menu.ItemLink href="#settings" shortcut="Ctrl+,">
            Settings
          </Menu.ItemLink>
          <Menu.ItemLink href="#billing" disabled>
            Billing
          </Menu.ItemLink>
          <Menu.Divider />
          <Menu.ItemLink
            href="https://example.com/help"
            target="_blank"
            rel="noreferrer"
            icon={{ children: 'โ†—' }}
          >
            Help center (opens in a new window)
          </Menu.ItemLink>
        </Menu.Popover>
      </>
    ),
  },
};

Submenus

export const Submenus: Story = {
  args: {
    'aria-label': undefined,
    onOpenChange: fn(),
    children: (
      <>
        <Menu.Trigger>
          <MenuButton>File</MenuButton>
        </Menu.Trigger>
        <Menu.Popover>
          <Menu.Item shortcut="Ctrl+N">New</Menu.Item>
          <Menu>
            <Menu.Trigger>
              <Menu.Item>Open recent</Menu.Item>
            </Menu.Trigger>
            <Menu.Popover>
              <Menu.Item onClick={fn()}>report.docx</Menu.Item>
              <Menu.Item onClick={fn()}>notes.txt</Menu.Item>
              <Menu>
                <Menu.Trigger>
                  <Menu.Item>Older</Menu.Item>
                </Menu.Trigger>
                <Menu.Popover>
                  <Menu.Item onClick={fn()}>archive-2025.zip</Menu.Item>
                  <Menu.Item onClick={fn()}>archive-2024.zip</Menu.Item>
                </Menu.Popover>
              </Menu>
            </Menu.Popover>
          </Menu>
          <Menu>
            <Menu.Trigger>
              <Menu.Item>Share</Menu.Item>
            </Menu.Trigger>
            <Menu.Popover>
              <Menu.Item onClick={fn()}>Email</Menu.Item>
              <Menu.Item onClick={fn()}>Copy link</Menu.Item>
            </Menu.Popover>
          </Menu>
          <Menu.Divider />
          <Menu.Item>Exit</Menu.Item>
        </Menu.Popover>
      </>
    ),
  },
};

Static With Submenu

export const StaticWithSubmenu: Story = {
  args: {
    'aria-label': 'Edit',
    // A static menu is as wide as its container: this width leaves its submenus room beside it.
    className: 'w-64',
    children: (
      <>
        <Menu.Item shortcut="Ctrl+X">Cut</Menu.Item>
        <Menu.Item shortcut="Ctrl+C">Copy</Menu.Item>
        <Menu>
          <Menu.Trigger>
            <Menu.Item>Paste special</Menu.Item>
          </Menu.Trigger>
          <Menu.Popover>
            <Menu.Item onClick={fn()}>Text only</Menu.Item>
            <Menu.Item onClick={fn()}>Keep formatting</Menu.Item>
          </Menu.Popover>
        </Menu>
        <Menu.SplitGroup>
          <Menu.Item onClick={fn()}>Find</Menu.Item>
          <Menu>
            <Menu.Trigger>
              <Menu.Item aria-label="More find options" />
            </Menu.Trigger>
            <Menu.Popover>
              <Menu.Item onClick={fn()}>Find next</Menu.Item>
              <Menu.Item onClick={fn()}>Replaceโ€ฆ</Menu.Item>
            </Menu.Popover>
          </Menu>
        </Menu.SplitGroup>
      </>
    ),
  },
};

Split Group

export const SplitGroup: Story = {
  args: {
    'aria-label': undefined,
    onOpenChange: fn(),
    children: (
      <>
        <Menu.Trigger>
          <MenuButton>File</MenuButton>
        </Menu.Trigger>
        <Menu.Popover>
          <Menu.Item>New</Menu.Item>
          <Menu.SplitGroup>
            <Menu.Item onClick={fn()} shortcut="Ctrl+S">
              Save
            </Menu.Item>
            <Menu>
              <Menu.Trigger>
                <Menu.Item aria-label="More save options" />
              </Menu.Trigger>
              <Menu.Popover>
                <Menu.Item onClick={fn()}>Save asโ€ฆ</Menu.Item>
                <Menu.Item onClick={fn()}>Save a copy</Menu.Item>
              </Menu.Popover>
            </Menu>
          </Menu.SplitGroup>
          <Menu.Item>Close</Menu.Item>
        </Menu.Popover>
      </>
    ),
  },
};

Exit Motion

export const ExitMotion: Story = {
  args: {
    'aria-label': undefined,
    onOpenChange: fn(),
    children: (
      <>
        <Menu.Trigger>
          <Button>Actions</Button>
        </Menu.Trigger>
        <Menu.Popover motion="transition-opacity duration-wave-fast data-[presence=exiting]:opacity-0 motion-reduce:transition-none">
          <Menu.Item onClick={fn()}>Edit</Menu.Item>
          <Menu.Item onClick={fn()}>Duplicate</Menu.Item>
          <Menu.Item onClick={fn()}>Delete</Menu.Item>
        </Menu.Popover>
      </>
    ),
  },
};

Motion

export const Motion: Story = {
  args: { 'aria-label': undefined, onOpenChange: fn() },
  render: function MotionMenus({ children: _children, ...args }) {
    return (
      <div className="flex flex-wrap gap-2">
        {motionCases(fadeAndZoom).map(({ label, motion }) => (
          // The story renders one menu per case; every other arg is forwarded.
          <Menu key={label} {...args}>
            <Menu.Trigger>
              <MenuButton>{label}</MenuButton>
            </Menu.Trigger>
            <Menu.Popover motion={motion}>
              <Menu.Item onClick={fn()}>Edit</Menu.Item>
              <Menu.Item onClick={fn()}>Duplicate</Menu.Item>
              <Menu>
                <Menu.Trigger>
                  <Menu.Item>Share</Menu.Item>
                </Menu.Trigger>
                <Menu.Popover motion={motion}>
                  <Menu.Item onClick={fn()}>Email</Menu.Item>
                  <Menu.Item onClick={fn()}>Copy link</Menu.Item>
                </Menu.Popover>
              </Menu>
            </Menu.Popover>
          </Menu>
        ))}
      </div>
    );
  },
};

Hover Menu

export const HoverMenu: Story = {
  args: {
    'aria-label': undefined,
    openOnHover: true,
    onOpenChange: fn(),
    children: (
      <>
        <Menu.Trigger>
          <MenuButton>View</MenuButton>
        </Menu.Trigger>
        <Menu.Popover>
          <Menu.Item onClick={fn()}>Zoom in</Menu.Item>
          <Menu.Item onClick={fn()}>Zoom out</Menu.Item>
          <Menu.Item onClick={fn()}>Actual size</Menu.Item>
        </Menu.Popover>
      </>
    ),
  },
};

Context Menu

Right-click a file, or press Shift+F10 on it.

export const ContextMenu: Story = {
  args: {
    'aria-label': undefined,
    openOnContext: true,
    defaultCheckedValues: { flags: ['synced'] },
    onOpenChange: fn(),
    children: (
      <>
        <Menu.Trigger>
          <div
            aria-keyshortcuts="Shift+F10"
            className="flex w-72 flex-col items-stretch gap-1 rounded-md border border-wave-border p-2"
          >
            <p className="px-2 text-wave-caption-1 text-wave-muted-foreground">
              Right-click a file, or press Shift+F10 on it.
            </p>
            {FILES.map((file) => (
              <Button key={file} appearance="subtle" className="justify-start">
                {file}
              </Button>
            ))}
          </div>
        </Menu.Trigger>
        <Menu.Popover aria-label="File actions">
          <Menu.Item onClick={fn()}>Open</Menu.Item>
          <Menu.Item onClick={fn()}>Rename</Menu.Item>
          <Menu.Divider />
          <Menu.ItemCheckbox name="flags" value="pinned">
            Pinned
          </Menu.ItemCheckbox>
          <Menu.ItemCheckbox name="flags" value="synced">
            Available offline
          </Menu.ItemCheckbox>
          <Menu.Divider />
          <Menu.Item onClick={fn()}>Delete</Menu.Item>
        </Menu.Popover>
      </>
    ),
  },
};

Custom Target

Layout
export const CustomTarget: Story = {
  args: { 'aria-label': undefined, onOpenChange: fn() },
  render: (args) => <CustomTargetMenu {...args} />,
};

Custom Menu Item

export const CustomMenuItem: Story = {
  args: {
    'aria-label': undefined,
    onOpenChange: fn(),
    defaultCheckedValues: { view: ['ruler'] },
    children: (
      <>
        <Menu.Trigger>
          <Button>New</Button>
        </Menu.Trigger>
        <Menu.Popover>
          <TemplateItem
            title="Blank document"
            description="Start from an empty page"
            onSelect={fn()}
          />
          <TemplateItem
            title="Meeting notes"
            description="Agenda, decisions and actions"
            onSelect={fn()}
          />
          <Menu.Divider />
          <Menu.Item icon={{ children: '๐Ÿ“‚' }} onClick={fn()}>
            Open
          </Menu.Item>
          <Menu.ItemCheckbox name="view" value="ruler">
            Show ruler
          </Menu.ItemCheckbox>
        </Menu.Popover>
      </>
    ),
  },
};

Item Content

export const ItemContent: Story = {
  args: {
    'aria-label': 'Message',
    children: (
      <>
        <Menu.Item subText="Mark as read and archive">Archive</Menu.Item>
        <Menu.Item secondaryContent={<strong>12</strong>}>Reply to all</Menu.Item>
        <Menu.Item shortcut="Ctrl+Shift+F">Forward</Menu.Item>
        <Menu.Item disabled>Share (skipped)</Menu.Item>
        <Menu.Item disabledFocusable subText="Ask the owner for access">
          Delete (reachable)
        </Menu.Item>
        <Menu.Item>Print</Menu.Item>
      </>
    ),
  },
};

Inline With Details

export const InlineWithDetails: Story = {
  args: {
    'aria-label': undefined,
    inline: true,
    closeOnScroll: true,
    onOpenChange: fn(),
    children: (
      <>
        <Menu.Trigger>
          <Button>Actions</Button>
        </Menu.Trigger>
        <Menu.Popover>
          <Menu.Item onClick={fn()}>Edit</Menu.Item>
          <Menu.Item onClick={fn()}>Duplicate</Menu.Item>
        </Menu.Popover>
      </>
    ),
  },
  decorators: [
    (Story) => (
      <div style={{ position: 'relative', padding: 24, minHeight: 160 }}>
        <Story />
      </div>
    ),
  ],
};

Props

NameTypeRequiredDefaultDescription
childrenReact.ReactNodeYes

Menu items and dividers (static menu), or a Menu.Trigger and a Menu.Popover (popup menu).

openbooleanNo

Controlled open state of a popup menu (Menu.Trigger + Menu.Popover). Passing it, even false (like passing defaultOpen or onOpenChange), makes Menu a popup menu that renders no element of its own: use it only with Menu.Trigger/Menu.Popover. Items outside Menu.Popover then have no role="menu" parent (development warning). Leave all three out for a static menu. The popup renders only in the browser: an open menu is closed in the server HTML and opens once it has hydrated.

defaultOpenbooleanNo

Initial open state of an uncontrolled popup menu; a popup menu starts closed without it. Passing it, even false, makes Menu a popup menu (see open), so for a Menu without Menu.Trigger/Menu.Popover children, leaving it out is not the same as false. The popup renders only in the browser: a menu open by default is closed in the server HTML and opens once it has hydrated.

onOpenChange(open: boolean, details?: MenuOpenChangeDetails) => voidNo

Called with the next open state when the popup menu opens or closes (only on change), and with details ({ reason, event }: what asked for it, see MenuOpenChangeReason, and the DOM event behind it; an event of the library's own, untrusted, when the change had none, such as a submenu that closes because its parent was closed from outside). Fluent's onOpenChange(event, data), with its data.type as reason. details is optional in the type for code written before it existed; WaveUI always passes it. Passing the callback makes Menu a popup menu (see open).

closeOnScrollbooleanNofalse

Close the popup menu when anything outside it and its trigger scrolls, the page included (reason: 'scroll'). A context menu (openOnContext) closes only when its anchor moves, as before, and ignores this; a submenu closes with its parent. Fluent's closeOnScroll.

inlinebooleanNofalse

Render the popup where the Menu.Popover is rendered instead of in a portal at the end of the <body>: the surface is positioned against its trigger with position: absolute, stacks above its siblings (--wave-z-overlay) and scrolls with the page. Use it where a portal breaks the context: inside a transformed or clipped container, a shadow root or an app region that is inert. A submenu inherits its parent's value unless it sets its own. Fluent's inline.

mountNodeHTMLElement | nullNothe provider's portal container, else `document.body`

The element the popup is portaled into (the portalContainer of WaveProvider, else the <body>), for one menu: a container in another document region or a shadow root. Ignored while inline. A submenu inherits its parent's value unless it sets its own. Fluent's mountNode (an element here; Fluent also takes { element, className }).

checkedValuesCheckedValuesNo

Checked items of the menu's checkbox, radio and switch items, per group name (controlled). A submenu without its own checkedValues or defaultCheckedValues shares its parent menu's state. Works for static and popup menus; unlike open, it does not make Menu a popup menu.

defaultCheckedValuesCheckedValuesNo{}

Initial checked items for uncontrolled usage (gives a submenu its own state).

onCheckedValuesChangeCheckedValuesChangeHandlerNo

Called when an item changes the checked items (only on change): the new checked values of every group first, then details with the group's name, its checkedItems and the event (Fluent's onCheckedValueChange(event, { name, checkedItems })). WaveUI always passes details. On a submenu that shares its parent's state it only listens: it is called after the parent's callback, for changes made in this submenu.

persistOnItemClickbooleanNofalse

Keep a popup menu open after any of its items is activated; an item's own persistOnClick wins. A submenu inherits it unless it sets it.

openOnHoverbooleanNofalse (true for a submenu)

Open the popup menu when a mouse pointer rests on its trigger, and close it once the pointer has been off the trigger and the menu for closeDelay while focus is not inside the menu. A menu opened by hover does not take focus; a click (or Enter, Space, ArrowDown) on its trigger keeps it open and moves focus into it, as opening it that way does. After Escape or an outside press it does not reopen until the pointer has left the trigger. Touch and pen never open it by hover, and an aria-disabled trigger never opens. A triangle between the trigger and the menu keeps it open while the pointer moves diagonally into it. Ignored with openOnContext (development warning) and on a static menu (development warning).

openDelaynumberNo250

Milliseconds a hovering mouse pointer rests on the trigger before the menu opens (mouse hover only). A submenu inherits its parent's, also from a static menu.

closeDelaynumberNo250

Milliseconds before a hover-opened menu closes once the mouse pointer has left it and its trigger (mouse hover only). A submenu inherits its parent's, also from a static menu.

openOnContextbooleanNofalse

Make Menu.Trigger a context-menu region: a right click (a Ctrl+click on macOS, a long press of a touch or pen pointer: 600 ms without moving, also in browsers that report no contextmenu for it, such as iOS Safari) opens the menu at the pointer, and Shift+F10 or the ContextMenu key opens it at the focused element inside the region, instead of a click; a second gesture while it is open moves it there. Focus returns to the element that had it. The browser's context menu is suppressed there and inside the menu, except in text fields inside the region, which keep it. A press elsewhere, a right click outside or a scroll that moves the region or the row of the gesture (the one under the pointer, or the focused one) closes it. The trigger gets no aria-haspopup/aria-expanded (it is not a menu button; with a render-prop child, do not spread them): name the menu with aria-label on Menu.Popover, and consider aria-keyshortcuts="Shift+F10" on the region. Ignored on a submenu; openOnHover is ignored with it.

refReact.Ref<HTMLDivElement>No

Ref to the static menu element (role="menu"). A popup menu renders no root element, so it ignores ref, className and other DOM props (development warning): pass them to Menu.Popover.

Any other prop is passed to the element it renders (HTMLDivElement).

Parts

  • Menu.Item
  • Menu.Divider
  • Menu.Trigger
  • Menu.Popover
  • Menu.ItemCheckbox
  • Menu.ItemRadio
  • Menu.ItemSwitch
  • Menu.ItemLink
  • Menu.Group
  • Menu.GroupHeader
  • Menu.SplitGroup

Stable class names

PartClass
rootwave-menu