Components
Menu

Menu

An accessible dropdown and context menu that is used to display a list of actions or options that a user can choose.

API reference docs for the component. Learn about the props, CSS, and other APIs of this exported module.

MenuProps

anchorPoint

Point

The positioning point for the menu. Can be set by the context menu trigger or the button trigger.

aria-label

string

The accessibility label for the menu

closeOnSelect

boolean

Whether to close the menu when an option is selected

dir

'ltr' | 'rtl'

The document's text/writing direction.

getRootNode

() => ShadowRoot | Node | Document

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

highlightedId

string

The `id` of the active menu item.

id

string

The unique identifier of the machine.

ids

Partial<{ trigger: string contextTrigger: string content: string label(id: string): string group(id: string): string positioner: string arrow: string }>

The ids of the elements in the menu. Useful for composition.

isOpen

boolean

loop

boolean

Whether to loop the keyboard navigation.

onFocusOutside

(event: FocusOutsideEvent) => void

Function called when the focus is moved outside the combobox

onInteractOutside

(event: InteractOutsideEvent) => void

Function called when an interaction happens outside the combobox

onOpenChange

(details: OpenChangeDetails) => void

Function called when the menu opens or closes

onPointerDownOutside

(event: PointerDownOutsideEvent) => void

Function called when the pointer is pressed down outside the combobox

onSelect

(details: SelectionDetails) => void

Function called when a menu item is selected.

onValueChange

(details: ValueChangeDetails) => void

Callback to be called when the menu values change (for radios and checkboxes).

positioning

PositioningOptions

The options used to dynamically position the menu

value

Record<string, string | string[]>

The values of radios and checkboxes in the menu.

MenuItemProps

id

string

The `id` of the menu item option.

closeOnSelect

boolean

Whether the menu should be closed when the option is selected.

disabled

boolean

Whether the menu item is disabled

valueText

string

The textual value of the option. Used in typeahead navigation of the menu. If not provided, the text content of the menu item will be used.

MenuContentProps

lazyMount

boolean

Whether to enable lazy mounting. Defaults to `false`.

onExitComplete

() => void

present

boolean

unmountOnExit

boolean

Whether to unmount on exit. Defaults to `false`.

MenuItemGroupProps

id

string

The `id` of the element that provides accessibility label to the option group

MenuOptionItemProps

name

string

The option's name as specified in menu's `context.values` object

type

'checkbox' | 'radio'

Whether the option is a radio or a checkbox

value

string

The value of the option

closeOnSelect

boolean

Whether the menu should be closed when the option is selected.

disabled

boolean

Whether the menu item is disabled

id

string

The `id` of the menu item option.

onCheckedChange

(checked: boolean) => void

Function called when the option state is changed

valueText

string

The textual value of the option. Used in typeahead navigation of the menu. If not provided, the text content of the menu item will be used.

MenuOptionItemState

isActive

boolean

MenuItemGroupLabelProps

htmlFor

string