Menu

Useful for displaying a list of actions. Typically not used directly but in conjunction with other components like RightClickMenu or DropdownMenu.

Props

PropTypeDescription
childrenMenuItem | MenuItemLabel | MenuItemSeparator | MenuItemCheckbox | MenuItemRadioGroupThe items to render
buttonRefReact.RefObjectA reference to a button element used to position the menu below
buttonTextRefReact.RefObjectA reference to the text element inside of a button, used as extra positioning information when the menu is used to build a Select
anchorPointPoint (x, y)An alternative way to position the menu directly by referencing a point in space, used when opening a menu via right click
isOpenBooleanWhether it is open or not
onDismissFunctionA function to be called when it is dismissed
highlightedIndexNumberThe index of the highlighted item (if controlled)
onHighlightedIndexChangeFunction (index?: number) => voidA function called when the highlighted item changes
defaultHighlightedIndexNumberThe index of the item to highlithed by default (if uncontrolled)
onItemSelectedFunction (item: Item) => voidA callback function called when an item has been selected
calculateMenuPositionFunction (options: CalculateMenuPositionOptions) => MenuPosition | undefinedA function used to specify how to calculate the menu position

MenuItem

Props

PropTypeDescription
labelStringThe label to display
valueStringAn optional value for the item
disabledBooleanWhether it is disabled or not
onSelectFunctionA function called when the item is selected

MenuItemSeparator

Props

No props

MenuItemLabel

Props

PropTypeDescription
childrenStringThe label to display

MenuItemCheckbox

Props

PropTypeDescription
labelStringThe label to display
valueStringAn optional value for the item
disabledBooleanWhether it is disabled or not
checkedBooleanWhether it is checked or not (if controlled)
onChangeFunction (checked?: boolean) => voidA function called when it is checked/unchecked
defaultCheckedBooleanWhether it is initially checked or not (if uncontrolled)

MenuItemRadioGroup

Props

PropTypeDescription
childrenMenuItemRadioThe radio items to render
valueStringThe selected value (if controlled)
onChangeFunction (value?: string) => voidA function called when the selected value changes
defaultValueStringThe default selected value (if uncontrolled)

MenuItemRadio

Props

PropTypeDescription
labelStringThe label to display
valueStringA value for the item
disabledBooleanWhether it is disabled or not