Menu
Combine a list of secondary actions into single interactive area
Source
LLM docs
Docs
Package
Usage
Submenus
Use safeAreaPolygon to keep a submenu open while the cursor moves from the target toward the dropdown.
Pass an object to adjust Floating UI safePolygon options, for example when offset creates a larger gap between the target and dropdown.
Search
Menu.Search renders a search input inside the dropdown. Focus stays on the input while
ArrowUp/ArrowDown move a highlight through items, and Enter triggers the highlighted item.
Filtering is controlled by the user – pass value and onChange and filter Menu.Item children
based on the query. By default, the search value is cleared automatically after the menu close
transition completes – disable with clearSearchOnClose={false} if you want to preserve the query
between openings.
The same approach works with submenus. To keep a parent visible when a nested item matches, include the parent in the filtered tree if any of its descendants match the query:
Checkbox items
Menu.CheckboxItem renders a menu item with a check indicator. It works like a regular
Checkbox – manage state with checked/onChange or use defaultChecked
for an uncontrolled value. By default, clicking a checkbox item does not close the menu;
set closeMenuOnClick on the item (or closeOnItemClick={false} on the Menu)
to override:
Checkbox group
Wrap Menu.CheckboxItem components in Menu.CheckboxGroup to manage multi-select state with a
single value: string[] / onChange pair (or defaultValue for uncontrolled). Each item needs
a value. Clicking an item toggles its value in the group:
Menu.CheckboxItem can still be used standalone (without a group) with its own checked /
defaultChecked / onChange props. Item-level checked and onChange also override the group
when both are present.
Radio items
Menu.RadioItem represents a single option inside a Menu.RadioGroup. The group manages
the selected value via value/onChange (or defaultValue for uncontrolled). The currently
selected item displays an indicator dot. Like checkbox items, radio items do not close the
menu on click by default:
Aligning labels of items with and without indicators
Use the alignItemsLabels prop on Menu to control how indicator slot space is reserved.
This is useful when mixing Menu.Item with Menu.CheckboxItem or Menu.RadioItem and you
want labels to start at the same horizontal position:
alignItemsLabels="with-indicators"(default) – reserves indicator space onMenu.CheckboxItemandMenu.RadioItemonly. RegularMenu.Itemis not padded.alignItemsLabels="all"– reserves indicator space on everyMenu.Item, so labels of plain items align with checkbox and radio items.alignItemsLabels="none"– reserves indicator space only on items that currently show an indicator. Unchecked checkbox and radio items render without the slot (layout shifts when toggled).
Custom check icon
Use the checkIcon prop to replace the default indicator rendered by Menu.CheckboxItem and
Menu.RadioItem. Setting checkIcon on Menu applies to all checkbox/radio items in the
dropdown. Setting checkIcon on an individual item overrides the menu-level value:
Type-ahead navigation
When focus is inside the dropdown and Menu.Search is not used, pressing a printable character
key moves focus to the next menu item whose label starts with the typed character. Pressing the
same character again cycles through items that start with it. Multiple characters typed in quick
succession (within 500ms) match items whose labels start with the full typed string. Disabled
items are skipped.
Context menu
Use Menu.ContextMenu to open the menu dropdown at the cursor position on right-click.
It replaces Menu.Target and wraps the element that should respond to the contextmenu event –
the browser's default context menu is suppressed, and the Mantine Menu.Dropdown is positioned
at the cursor instead. Right-clicking again repositions the dropdown to the new coordinates.
Set disabled to restore the browser's default context menu:
Right-click anywhere inside this area
The menu will open at the cursor position
Controlled
The dropdown's opened state can be controlled with the opened and onChange props:
Show menu on hover
Set trigger="hover" to reveal the dropdown when hovering over the menu target and dropdown.
The closeDelay and openDelay props can be used to control open and close delay in ms.
Note that:
- If you set
closeDelay={0}then the menu will close before the user reaches the dropdown, so setoffset={0}to remove space between the target element and dropdown. - Menu with
trigger="hover"is not accessible – users that navigate with the keyboard will not be able to use it. If you need both hover and click triggers, usetrigger="click-hover".
To make a Menu that is revealed on hover accessible on all devices, use trigger="click-hover" instead.
The dropdown will be revealed on hover on desktop and on click on mobile devices.
Disabled items
Dropdown position
Transitions
The Menu dropdown can be animated with any of the premade transitions from the Transition component:
Custom component as Menu.Item
By default, Menu.Item renders as a button element. To change that, set the component prop:
Note that the component you pass to the component prop should allow spreading props to its root element:
Custom component as target
Styles API
Menu supports the Styles API; you can add styles to any inner element of the component with the classNames prop. Follow the Styles API documentation to learn more.
Component Styles API
Hover over selectors to highlight corresponding elements
Menu.Target children
Menu.Target requires an element or a component as a single child – strings, fragments, numbers, and multiple elements/components are not supported and will throw an error. Custom components must provide a prop to get the root element ref; all Mantine components support ref out of the box.
Required ref prop
Custom components that are rendered inside Menu.Target are required to support the ref prop:
Pass ref to the root element:
Accessibility
Menu follows WAI-ARIA recommendations:
- Dropdown element has
role="menu"andaria-labelledby="target-id"attributes - Target element has
aria-haspopup="menu",aria-expanded,aria-controls="dropdown-id"attributes - Menu item has
role="menuitem"attribute
Whilst the dropdown is unopened, the aria-controls attribute will be undefined
Supported target elements
An uncontrolled Menu with trigger="click" (default) will be accessible only when used with a button element or component that renders it (Button, ActionIcon, etc.).
Other elements will not support Space and Enter key presses.
Hover menu
Menu with trigger="hover" is not accessible – it cannot be accessed with the keyboard. Use it only if you do not care about accessibility. If you need both hover and click triggers, use trigger="click-hover".
Navigation
If you are using the Menu to build navigation, you can use the options from the demo below to follow the WAI-ARIA recommendations for navigation.
Keyboard interactions
If you also need to support Tab and Shift + Tab then set menuItemTabIndex={0}.