Skip to main content

Overview

Menu provides a dropdown menu with extensive features including nested submenus, keyboard navigation, grouping, separators, and optional autocomplete filtering for large menus.

Basic usage

Components

The root component that manages menu state and keyboard navigation.
boolean
Controls the open state of the menu (controlled mode).
boolean
The initial open state in uncontrolled mode.
(open: boolean) => void
Callback fired when the open state changes.
boolean
default:"true"
Whether the menu is modal. Always true, cannot be overridden.
boolean
default:"false"
Whether to loop focus when navigating with arrow keys. Always false, cannot be overridden.
boolean
Enable autocomplete mode with a search input at the top of the menu.
'auto' | 'manual'
default:"'auto'"
Auto mode: Automatically filters menu items based on the input value. Manual mode: Provides input value but doesn’t filter items automatically.
string
Controlled value for the autocomplete input (requires autocomplete to be true).
(value: string) => void
Callback fired when the autocomplete input value changes.
string
The initial input value in uncontrolled mode.
A button that opens the menu when clicked.
boolean
When true, merges props with the immediate child element instead of rendering a button.
boolean
default:"true"
Whether to stop click event propagation.
The menu content container with positioning logic.
'top' | 'right' | 'bottom' | 'left'
default:"'bottom'"
The preferred side of the trigger to render the menu.
'start' | 'center' | 'end'
default:"'start'"
The preferred alignment against the trigger.
number
default:"4"
The distance in pixels from the trigger.
string
default:"'Search...'"
Placeholder text for the autocomplete input (when autocomplete is enabled).
string
Additional CSS classes for the menu content.
An individual menu item that can be selected.
() => void
Callback fired when the item is selected.
boolean
Whether the item is disabled.
string
The value used for autocomplete filtering. If not provided, uses the text content.
React.ReactNode
Icon or element displayed before the item text.
React.ReactNode
Icon or element displayed after the item text.
A container for grouping related menu items. A label for a group of menu items. A visual separator between menu items or groups. A component to display when no menu items match the search (useful with autocomplete). A nested submenu component with its own state and autocomplete support.
boolean
Enable autocomplete mode for the submenu.
'auto' | 'manual'
default:"'auto'"
Autocomplete filtering mode for the submenu.
A menu item that opens a submenu. Automatically shows a right arrow icon.
string
The value used for autocomplete filtering.
React.ReactNode
Icon or element displayed before the item text.
React.ReactNode
Icon or element displayed after the item text. Defaults to a right arrow.
The content container for a submenu. Has the same props as Menu.Content but with sideOffset defaulting to 2.

Usage examples

Nested submenu

Controlled autocomplete

Disabled items

Autocomplete filtering

The Menu component supports two autocomplete modes:

Auto mode (default)

Automatically filters menu items based on the search input. Items that don’t match are hidden:
Filtering logic:
  • Matches against the value prop if provided
  • Falls back to matching against the item’s text content
  • Case-insensitive matching
  • Shows Menu.EmptyState when no items match

Manual mode

Provides the search input but doesn’t filter items automatically. You control the filtering logic:

Accessibility features

  • Keyboard navigation: Arrow keys to navigate, Enter/Space to select
  • Type-ahead: Start typing to highlight matching items (when autocomplete is disabled)
  • ESC to close: Press Escape to close the menu
  • Focus management: Automatic focus handling between menu and submenus
  • Arrow key submenu navigation: Right arrow opens submenu, left arrow closes it
  • ARIA attributes: Proper ARIA roles and relationships
  • Focus trap: Focus stays within the menu when open

Trigger patterns

The Menu.Trigger component can be used in two ways:
  1. Default button: Renders a button when no children are provided or asChild is false
  2. Custom trigger: Use asChild prop to merge menu functionality with your component