Render a Button through render on MenuTrigger. Give an item label when it has a MenuShortcut, so type-ahead matches the name.
The sample also uses Button. One command adds them with this item:
edit-menu.tsx
Menu
| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From Base UIMenu.RootBase UI docs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| default | boolean | false | Whether the menu is initially open. To render a controlled menu, use the open prop instead. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| loop | boolean | true | Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| highlight | boolean | true | Whether moving the pointer over items should highlight them. Disabling this prop allows CSS :hover to be differentiated from the :focus (data-highlighted) state. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MenuFilter
| Prop | Type | Default | Description | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From Base UIMenu.FilterProviderBase UI docs | ||||||||||||||||||||||
| children | ReactNode | — | The <Menu.Root> or <Menu.SubmenuRoot> to make filterable. | |||||||||||||||||||
| filter | — | Filter function used to match items against the query. Receives each item's label (or its rendered text) and the trimmed query, and keeps the item when it returns true. By default, items match when they contain the query, ignoring case, accents, and punctuation. Pass null when rendering filtered items yourself. | ||||||||||||||||||||
| auto | "always" | boolean | true | Whether filtering highlights the first matching item automatically. - true: highlight it while the query is not empty. - 'always': highlight it even when the query is empty. Opening the menu from the keyboard highlights the first item either way, and the arrow keys can move the highlight to another item. With either value, the arrow keys wrap within the list rather than returning to the input, and with 'always' a pointer highlight stays when the pointer leaves. | |||||||||||||||||||
| ||||||||||||||||||||||
MenuTrigger
<button>| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||||||||||||||
From Base UIMenu.TriggerBase UI docs | |||||||||||||||||||||||||||||||||||||
| children | ReactNode | — | |||||||||||||||||||||||||||||||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | ||||||||||||||||||||||||||||||||||
| handle | MenuHandle<unknown> | — | A handle to associate the trigger with a menu. | ||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. | ||||||||||||||||||||||||||||||||||
MenuContent
<div>| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrow | boolean | false | Show an arrow that points at the trigger. The gap grows from 4px to 8px. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backdrop | boolean | false | Put a clear layer under the popup (Base UI Menu.Backdrop), for example to dim it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| portal | — | Other Base UI props of the inner parts. A className here adds to the component classes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| positioner | — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backdrop | PopupPartProps<MenuBackdropProps> | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrow | PopupPartProps<MenuArrowProps> | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From Base UIMenu.PopupBase UI docs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| children | ReactNode | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id | string | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| final | — | Determines the element to focus when the menu is closed. - false: Do not move focus. - true: Move focus based on the default behavior (trigger or previously focused element). - RefObject: Move focus to the ref element. - function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, or false/undefined to do nothing. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MenuInput
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| clear | string | "Clear filter" | The accessible name of the clear button. Translate it with the page. |
| clear | PopupPartProps<MenuClearProps> | — | Other Base UI props of the clear button (Menu.Clear). |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
MenuGroup
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
From Base UIMenu.GroupBase UI docs | |||
| children | ReactNode | — | The content of the component. |
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
MenuGroupLabel
<div>MenuItem
<div>| Prop | Type | Default | Description | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| inset | boolean | — | |||||||||||||||||||||||||||
| variant | "default""destructive" | — | |||||||||||||||||||||||||||
| class | string | — | |||||||||||||||||||||||||||
From Base UIMenu.ItemBase UI docs | |||||||||||||||||||||||||||||
| on | — | The click handler for the menu item. | |||||||||||||||||||||||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | ||||||||||||||||||||||||||
| label | string | — | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided. | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||||||
MenuLinkItem
<a>| Prop | Type | Default | Description |
|---|---|---|---|
| inset | boolean | — | |
| variant | "default""destructive" | — | |
| class | string | — | |
From Base UIMenu.LinkItemBase UI docs | |||
| label | string | — | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided. |
| id | string | — | |
| close | boolean | false | Whether to close the menu when the item is clicked. |
| ...props | <a> attributes | — | Every other attribute goes to the <a>, with a ref. |
MenuCheckboxItem
<div>| Prop | Type | Default | Description | |||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | ||||||||||||||||||||||||||||||||||||||||||
| indicator | "check""switch" | "check" | The mark of the setting. check (default): a check in the 16px start slot. switch: the Switch look at the inline end, for a setting that reads as on or off ("Thinking", "Web search"), with no start slot. The item is still one menuitemcheckbox: the switch is drawn by two CheckboxItemIndicator parts that stay mounted, so it reads the item state (data-checked) with no second control inside the item. A disabled item dims once: the row is at 50%, and the switch keeps full opacity inside it (the Switch component would dim it again to 25%). | |||||||||||||||||||||||||||||||||||||||||
| indeterminate | boolean | — | Some, not all (with indicator="check"): a dash in the start slot and aria-checked="mixed", for an "All" item over a list of items where only some are on (the Source Picker). Pass it with checked={false}: a press then calls onCheckedChange(true), so a mixed item turns all on, as a tri-state checkbox does. The dash fades on the fade token, as the check. | |||||||||||||||||||||||||||||||||||||||||
From Base UIMenu.CheckboxItemBase UI docs | ||||||||||||||||||||||||||||||||||||||||||||
| checked | boolean | — | Whether the checkbox item is currently ticked. To render an uncontrolled checkbox item, use the defaultChecked prop instead. | |||||||||||||||||||||||||||||||||||||||||
| default | boolean | false | Whether the checkbox item is initially ticked. To render a controlled checkbox item, use the checked prop instead. | |||||||||||||||||||||||||||||||||||||||||
| on | — | Event handler called when the checkbox item is ticked or unticked. | ||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | |||||||||||||||||||||||||||||||||||||||||
MenuRadioGroup
<div>| Prop | Type | Default | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | ||||||||||||||||||||||||||
From Base UIMenu.RadioGroupBase UI docs | ||||||||||||||||||||||||||||
| children | ReactNode | — | The content of the component. | |||||||||||||||||||||||||
| value | any | — | The controlled value of the radio item that should be currently selected. To render an uncontrolled radio group, use the defaultValue prop instead. | |||||||||||||||||||||||||
| default | any | — | The uncontrolled value of the radio item that should be initially selected. To render a controlled radio group, use the value prop instead. | |||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | |||||||||||||||||||||||||
MenuRadioItem
<div>| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||||||||||
| indicator | "dot""end-check" | "dot" | The mark of the chosen item. dot (default): an 8px dot in the 16px start slot. end-check: a check in a 16px slot at the inline end, with no start slot, for rich rows that lead with their own icon or logo (a model, an account). The slot pushes itself to the end (ms-auto); with a value before it, let the text grow (flex-1), or two auto margins share the room. | ||||||||||||||||||||||||||||||
From Base UIMenu.RadioItemBase UI docs | |||||||||||||||||||||||||||||||||
| value | any | — | Value of the radio item. This is the value that will be set in the MenuRadioGroup when the item is selected. | ||||||||||||||||||||||||||||||
| on | — | The click handler for the menu item. | |||||||||||||||||||||||||||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||||||||||
MenuShortcut
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
MenuSeparator
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| variant | "dashed""dotted""double""fade""solid" | — | The line pattern. Default: solid. |
| tone | "default""destructive""info""muted""primary""success""warning" | — | The color, from the shared tokens. Default: default (the border color). |
| children | ReactNode | — | Content in the middle of a horizontal line: "or", a date, an icon. The line then splits in two halves around it, and a text label is the name that screen readers hear. |
From Base UISeparatorBase UI docs | |||
| orientation | "horizontal""vertical" | 'horizontal' | The orientation of the separator. |
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
MenuSub
| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From Base UIMenu.SubmenuRootBase UI docs | |||||||||||||||||||||||||||||||||||||||||||||
| on | — | Event handler called when the menu is opened or closed. | |||||||||||||||||||||||||||||||||||||||||||
| close | boolean | false | When in a submenu, determines whether pressing the Escape key closes the entire menu, or only the current child menu. | ||||||||||||||||||||||||||||||||||||||||||
| children | ReactNode | — | The content of the submenu. | ||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||
MenuSubTrigger
<div>| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||||||||||||||
| inset | boolean | — | Line the text up with items that have a 16px slot. | ||||||||||||||||||||||||||||||||||
From Base UIMenu.SubmenuTriggerBase UI docs | |||||||||||||||||||||||||||||||||||||
| on | — | ||||||||||||||||||||||||||||||||||||
| label | string | — | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided. | ||||||||||||||||||||||||||||||||||
| id | string | — | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||||||||||||||
MenuSubContent
<div>| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrow | boolean | false | Show an arrow that points at the trigger. The gap grows from 4px to 8px. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| portal | — | Other Base UI props of the inner parts. A className here adds to the component classes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| positioner | — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrow | PopupPartProps<MenuArrowProps> | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From Base UIMenu.PopupBase UI docs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| anchor | — | An element to position the popup against. By default, the popup will be positioned against the trigger. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| position | "absolute""fixed" | 'absolute' | Determines which CSS position property to use. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| side | number | OffsetFunction | 0 | Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment. The function takes a data object parameter with the following properties: - data.anchor: the dimensions of the anchor element with properties width and height. - data.positioner: the dimensions of the positioner element with properties width and height. - data.side: which side of the anchor element the positioner is aligned against. - data.align: how the positioner is aligned relative to the specified side. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MenuSegmentedRadioGroup
<div>| Prop | Type | Default | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | ||||||||||||||||||||||||||
From Base UIMenu.RadioGroupBase UI docs | ||||||||||||||||||||||||||||
| children | ReactNode | — | The content of the component. | |||||||||||||||||||||||||
| value | any | — | The controlled value of the radio item that should be currently selected. To render an uncontrolled radio group, use the defaultValue prop instead. | |||||||||||||||||||||||||
| default | any | — | The uncontrolled value of the radio item that should be initially selected. To render a controlled radio group, use the value prop instead. | |||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | |||||||||||||||||||||||||
MenuSegmentedRadioItem
<div>| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||||||||||
From Base UIMenu.RadioItemBase UI docs | |||||||||||||||||||||||||||||||||
| value | any | — | Value of the radio item. This is the value that will be set in the MenuRadioGroup when the item is selected. | ||||||||||||||||||||||||||||||
| on | — | The click handler for the menu item. | |||||||||||||||||||||||||||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||||||||||
| EnterorSpace | On the trigger: opens the menu. |
|---|---|
| Arrow DownorArrow Up | On the trigger, opens the menu. In the menu, moves to the next or the previous item. |
| HomeorEnd | Moves to the first or the last item. |
| EnterorSpace | On an item: runs the item, or changes a check or a radio choice. |
| Letter keys | Moves to the item whose text starts with the typed letters. |
| Arrow Right | Opens a submenu. In right to left, use Arrow Left. |
| Arrow Left | Closes a submenu. In right to left, use Arrow Right. |
| Escape | Closes the menu. In a submenu it closes only the submenu, unless closeParentOnEsc is set. |
- Context MenuPick Context Menu for the same actions at the pointer on a right click or a long press, as a second way in.
- PopoverA panel that opens from a button and stays until people close it. It holds content they can use, such as a share link, filters, or a short form.
- SelectPick Select to set a value that a form sends, not to run an action.
- CommandPick Command for a search field over many commands, such as a command palette or a quick switcher.
Built with
Installs with Menu







