Skip to main content

Common Examples

To use the Menu, pass a Carto Button through trigger and configured MenuOption objects through items. The kit forbids composed menu-item children.

Selection

The default selectionMode="none" creates an action menu that closes after activation. Use "single" or "multiple" for persistent checked selections.

Icons and disabled options

Pass an icon from @servicetitan/anvil2-icons through an option’s icon field. Set isDisabled on an option to prevent focus, selection, and activation.Pass href to render an option as a navigation link. An option with target="_blank" receives a safe rel default and a localized new-tab announcement.

Placement and long lists

placement opens the popover above or below its trigger with a fixed 4px gap. Long labels wrap at the 360px width ceiling, and long lists scroll within available viewport height.

Internationalization

Menu option labels are consumer content and must be localized before they are passed in items. External link options use ai-kit.menu.opensInNewTab for the hidden new-tab announcement.

React Accessibility

  • React Aria supplies keyboard navigation, typeahead, focus management, and selection semantics.
  • Arrow keys move between options. Enter or Space activates the focused option. Escape closes the menu and restores focus to the trigger.
  • External link options include a localized hidden new-tab announcement.
Last modified on August 28, 2026