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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
__namedParameters | MenuProps |
Returns
Section titled “Returns”Element
Example
Section titled “Example”<Menu items={[ { label: "New File", value: "new" }, { label: "Open...", value: "open" }, { label: "Quit", value: "quit" }, ]} onSelect={(value) => handleAction(value)} highlightColor="magenta"/>Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
defaultSelectedIndex? | number | Initial index for uncontrolled mode |
focusable? | boolean | Whether the menu is focusable (default: true) |
highlightColor? | Color | Color for the selected item indicator and text (default: “cyan”) |
items | MenuItem[] | - |
onSelect? | (value, index) => void | Callback when enter is pressed on item |
onSelectionChange? | (index) => void | Callback when selected index changes |
selectedIndex? | number | Controlled selected index |
style? | Style | Outer box style |
MenuItem
Section titled “MenuItem”A single item in a Menu.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
disabled? | boolean | When true, the item is dimmed and cannot be selected. |
label | string | Display text. |
value | string | Value returned when this item is selected. |