Skip to main content

AriaMenuItem

type AriaMenuItem = Omit<ItemProps<typeof Item>, "children"> & object;

The structure of a menu item that can be used to create a dropdown menu.

Type Declaration​

NameTypeDescription
keystringThe unique key for the item.
labelReact.ReactNodeThe label of the item.
description?React.ReactNodeOptional description of the item. This will be displayed below the menu item.
testId?stringThe test id for the item.
onItemClick()?() => voidIf set, this function will be called when the user clicks this item.
closeMenuOnItemClick?booleanIf set to false, the menu will not close when the user clicks this item.
subMenu?AriaSubMenuIf set, clicking the item runs onItemClick (if provided) and opens a submenu in place. The submenu can render a nested list of AriaMenuItem or arbitrary React content, and a back button is rendered at the top of the menu to return to the previous level. The menu is not closed when a submenu is opened.
icon?React.ReactNodeThe icon to display next to the item.
iconPosition?"start" | "end"Where to place the icon relative to the label. 'start' (the default) renders the icon before the label; 'end' renders it after the label, pushed to the far end of the item.
alternativeHoverClassName?stringClass name that is used to override the default hover style.
alternativeHoverStyle?CSSPropertiesStyle that is used to override the default hover style.
className?stringThe class name for the item.
style?CSSPropertiesThe style for the item.
isActive?booleanSets the data-active attribute to true and applies styling
isDisabled?booleanIf set to true, the item will be disabled.
isDanger?booleanIf set to true, the item uses the danger text color.
isChecked?booleanMarks the item as a checkable menu item and reports the given state.
withTopDivider?booleanIf set to true, a divider will be rendered above the item.
withBottomDivider?booleanIf set to true, a divider will be rendered below the item.