Skip to main content

Common Examples

Creating simple dropdown menus

The Menu and Menu.Item components can be used to compose basic dropdown menus.

Nesting menus in dropdowns

To create nested dropdown menus, simply add a Menu as a child of another Menu.

Creating custom menu triggers

To use a custom trigger element, use the trigger prop of the Menu, and omit the label prop (and any other prop meant to be passed to the default Button trigger).

Creating custom nested menu triggers

Nested menus support the trigger prop the same way root menus do. Spread all props onto your trigger element, including ref, className, and data-anv, so the nested item receives menu styling and participates in keyboard navigation. A custom trigger replaces the default nested button, including the submenu chevron — include that icon in your markup.

React Accessibility

When using a custom trigger, make sure that the trigger:
  • Can receive focus via keyboard when tabbing.
  • Opens the menu when the user presses enter.
  • Closes the menu and returns focus to the trigger when the user presses escape.
Nested custom triggers also need:
  • role, data-anv, and tabIndex spread onto the element so the parent menu’s focus query includes them.
  • ArrowRight to open the submenu.
  • ArrowLeft to close the submenu and return focus to the nested trigger.
For more guidance on accessible menu interactions, see keyboard navigation and focus management best practices.
Last modified on September 4, 2026