Menu

16 parts

The unstyled, low-level menu engine that powers DropdownMenu, ContextMenu, and Menubar. It is built on Popper and wires up roving-focus keyboard navigation, typeahead, nested submenus, checkbox/radio items, and modal vs. non-modal dismissal — but it is deliberately trigger-agnostic, so consumers supply their own anchor and open logic. Use this directly only when composing a new menu-like primitive; for ordinary app menus reach for DropdownMenu or ContextMenu instead. MenuRoot owns open state and provides context to every part; bind v-model:open (or listen to update:open) to control or observe whether the menu is open.

Anatomy

Import the parts and compose them. Each part forwards attributes to its underlying element.

vue
import {
  MenuAnchor,
  MenuArrow,
  MenuCheckboxItem,
  MenuContent,
  MenuGroup,
  MenuItem,
  MenuItemIndicator,
  MenuLabel,
  MenuPortal,
  MenuRadioGroup,
  MenuRadioItem,
  MenuRoot,
  MenuSeparator,
  MenuSub,
  MenuSubContent,
  MenuSubTrigger,
} from '@robonen/primitives/menus/menu';

<MenuRoot>
  <MenuAnchor />
  <MenuArrow />
  <MenuCheckboxItem />
  <MenuContent />
  <MenuGroup />
  <MenuItem />
  <MenuItemIndicator />
  <MenuLabel />
  <MenuPortal />
  <MenuRadioGroup />
  <MenuRadioItem />
  <MenuSeparator />
  <MenuSub />
  <MenuSubContent />
  <MenuSubTrigger />
</MenuRoot>

API Reference