Skip to content

Menu

function Menu(__namedParameters): Element;

Pre-styled menu built on top of List.

Renders a vertical list of labeled items with a > selection indicator and highlight color. Navigation uses the same keyboard shortcuts as List (↑/↓, j/k, gg/G, Enter).

ParameterType
__namedParametersMenuProps

Element

<Menu
items={[
{ label: "New File", value: "new" },
{ label: "Open...", value: "open" },
{ label: "Quit", value: "quit" },
]}
onSelect={(value) => handleAction(value)}
highlightColor="magenta"
/>

PropertyTypeDescription
defaultSelectedIndex?numberInitial index for uncontrolled mode
focusable?booleanWhether the menu is focusable (default: true)
highlightColor?ColorColor for the selected item indicator and text (default: “cyan”)
itemsMenuItem[]-
onSelect?(value, index) => voidCallback when enter is pressed on item
onSelectionChange?(index) => voidCallback when selected index changes
selectedIndex?numberControlled selected index
style?StyleOuter box style

A single item in a Menu.

PropertyTypeDescription
disabled?booleanWhen true, the item is dimmed and cannot be selected.
labelstringDisplay text.
valuestringValue returned when this item is selected.