Import
Basic Usage
Key Components
Menu.Root
Groups all parts of the menu. Doesn’t render its own HTML element. Key Props:open:boolean- Whether the menu is currently open (controlled)defaultOpen:boolean- Whether the menu is initially open (uncontrolled, default:false)onOpenChange:(open: boolean, eventDetails: ChangeEventDetails) => void- Event handler called when the menu is opened or closedmodal:boolean- Determines if the menu enters a modal state when open (default:true)loopFocus:boolean- Whether to loop keyboard focus back to the first item (default:true)orientation:'horizontal' | 'vertical'- The visual orientation of the menu (default:'vertical')disabled:boolean- Whether the component should ignore user interaction (default:false)closeParentOnEsc:boolean- Whether pressing Escape closes the entire menu or only the current submenu (default:false)
Menu.Trigger
A button that opens the menu. Renders a<button> element.
Key Props:
disabled:boolean- Whether the trigger is disabled (default:false)openOnHover:boolean- Whether the menu should open when the trigger is hovereddelay:number- How long to wait before opening the menu on hover, in milliseconds (default:100)closeDelay:number- How long to wait before closing the menu on hover, in milliseconds (default:0)
data-open: Present when the menu is opendata-disabled: Present when the trigger is disabled
Menu.Popup
A container for the menu items. Renders a<div> element.
Key Props:
finalFocus: Determines the element to focus when the menu is closed
data-open: Present when the menu is opendata-side: The side of the anchor element where the menu is positioneddata-align: The alignment of the menu relative to the anchor
Menu.Item
An individual interactive item in the menu. Renders a<div> element.
Key Props:
disabled:boolean- Whether the item should ignore user interaction (default:false)closeOnClick:boolean- Whether to close the menu when the item is clicked (default:true)label:string- Overrides the text label used during keyboard text navigation
data-disabled: Present when the item is disableddata-highlighted: Present when the item is highlighted
Menu.CheckboxItem
A menu item with a checkbox. Renders a<div> element.
Key Props:
checked:boolean- Whether the checkbox is checked (controlled)defaultChecked:boolean- Whether the checkbox is initially checked (uncontrolled)onCheckedChange:(checked: boolean) => void- Event handler called when the checked state changes
Menu.RadioGroup
Groups radio items together. Key Props:value:any- The value of the selected radio item (controlled)defaultValue:any- The initially selected radio item (uncontrolled)onValueChange:(value: any) => void- Event handler called when the value changes
Menu.RadioItem
A menu item with a radio button. Key Props:value:any- The value of this radio item (required)
Features
- Full keyboard navigation with arrow keys
- Typeahead search to quickly find items
- Optional hover interactions
- Support for nested submenus
- Checkbox and radio item variants
- Flexible positioning with
Menu.Positioner - Optional backdrop with
Menu.Backdrop - Portal rendering with
Menu.Portal - Accessible ARIA attributes