Skip to main content
For development, import Menu from @servicetitan/anvil2. For design, find it in the Anvil2 file.

Anatomy

The Menu consists of four primary elements that work together to provide users with an actionable list of options.
Menu
anatomy
  1. Trigger
  2. Popover
  3. Menu item
  4. Nested Menu item

Searchable

A searchable Menu adds three optional elements to the popover.
Searchable Menu
anatomy
  1. Trigger
  2. Popover
  3. Search field (optional)
  4. Group heading (optional)
  5. Menu item
  6. Footer buttons (optional)

Options

The Menu supports flat and nested configurations to accommodate various action list scenarios. For long action lists, it also supports search, groups, and footer buttons.

Flat

Menu options
default

Nested

Menu options
nested

Searchable

searchable adds a search field above the items. By default, the Menu filters Menu.Items by their label, and by searchText when a label is not plain text. Nested menus are not filtered.

Groups

Menu.Group adds a headed section of items. While the Menu filters, a group hides entirely once none of its items match. footerButtons pins actions below the items under a divider. Footer buttons stay visible while the user searches, so they suit actions that do not depend on the query, such as “Add technician”.

Manual filtering

Set manualFilter to turn off the built-in filtering. The Menu still owns the search field, and you choose which items to render for the current searchValue. Use it when results come from a server or need custom matching.

Behavior

The Menu responds to user interaction with distinct visual states and synchronized focus and hover behaviors.

Visual States

Default

Menu states
default

Hover

Menu states
hover

Disabled

Menu states
disabled

Focusing

Focus and hover states are synchronized. Moving the mouse over a menu item will automatically set focus to that item. Similarly, navigating through the menu with keyboard focus will trigger the hover state on the focused item.

Searchable Menu

A searchable Menu responds to the search field and to the height of its content.
  • Focus starts in the search field when the Menu opens.
  • Closing the Menu clears the search.
  • When no item matches, the Menu shows “No results found”.
  • The search field and footer stay fixed. Only the list scrolls.
  • Overflow arrows appear at the top or bottom of the list when items are scrolled out of view. They never cover the search field or footer.

Usage Guidelines

Alternatives

The Menu is used to perform actions on the page, and sometimes also a navigational context. Select Menu and Multi Select Menu attach to a button or other custom trigger when the user is choosing options. A labeled field uses Select Field for single selection or Multi Select Field for multiple selection. When a list of actions need to take place, the Menu should be used. It is not recommended to recreate menu-like interactions through a Popover.

How to Use

Parent and Children

Menu trigger should have direct relationship to its children. This also applies to the nested version of the Menu.
Menu parent children
example
Nested Menu
example
Nested menu example

Disabled Handling

  • When an action is temporarily unavailable, use disabled state
  • When a user does not have the credentials to take action, do not display these unavailable actions to them. This avoids cluttering the UI and confusing the user when they are unable to take action. When a component is disabled, it is not interactive, meaning tooltips are not available to inform more.

Grouping

Use Menu.Group to organize related items under a heading, most often in a searchable Menu. To reveal a related set of actions on demand instead, use the Nested Menu.

Content

Content within the Menu should clearly communicate each action through descriptive labels. For content guidance, refer to the content guidance provided in the Button. Write footer button labels as short verb phrases, such as “Add technician”.

Keyboard Interaction

Users can navigate the Menu using standard keyboard controls.

Trigger

Searchable Menu

A searchable Menu adds the following controls.

Code

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.

Searching and grouping items

Set searchable to add a search field, and use Menu.Group to organize items under headings. Pass searchText to a Menu.Item to match text beyond its label.footerButtons accepts a label, an onClick, and an optional icon. The Menu closes before onClick runs.

Filtering the items yourself

To control which items render, set manualFilter, hold the query with searchValue and onSearchChange, and render only the matching items. The Menu calls onSearchChange("") when it closes, so your state resets with it.

React Accessibility

The search field takes its accessible name from searchPlaceholder, which defaults to “Search”, and controls the item list. When no item matches, the Menu announces “No results found” through a status region. Footer buttons are reached with Tab, or with Arrow Down from the last item.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 November 25, 2026