Menu
Floating contextual menu anchored to an activator element. Supports nested sub-menus, keyboard navigation, items array shorthand, and full slot customisation.
Structure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-menu> — 5 parts: activator (slot), content panel, optional title subheader, and list items (rendered from the items array or default slot).- 1#activator slot
- The element that triggers the menu open/close. Receives an event-binding props object from the overlay.
- 2.origam-menu__list
- OrigamList container rendered inside the overlay panel (default slot fallback).
- 3.origam-menu__title
- Optional OrigamListSubheader injected when the title prop is set.
- 4.origam-menu__items
- OrigamListGroup container iterating over the items array.
- 5.origam-menu__item
- Each OrigamListItem rendered from the items array. When an item has children, a nested OrigamMenu is rendered instead.
API
Props
All props accepted by this component, with their type, default value and description.
- idstring
- HTML id applied to the overlay root and referenced by aria-owns on the activator.
- absoluteboolean
- closeOnBackbooleantrue
- Closes the menu when the user presses Escape or navigates back.
- contentClassstring | Array<string>
- contentPropsany
- disabledboolean
- noClickAnimationboolean
- modelValuebooleanfalse
- Controls the open/closed state. Use v-model to sync with parent.
- zIndexnumber | string
- disableGlobalStackboolean
- persistentboolean
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- heightnumber | string
- maxHeightnumber | string
- Maximum height before the menu becomes scrollable. Default: calc(100vh - 32px) from the token.
- maxWidthnumber | string
- Maximum width of the menu surface.
- minHeightnumber | string
- minWidthnumber | string
- Minimum width of the menu surface. Defaults to the activator width when unset.
- widthnumber | string
- target'parent' | 'cursor' | TAnyString | Element | ComponentPublicInstance | [x: number, y: number] | undefined
- activator'parent' | 'cursor' | TAnyString | Element | ComponentPublicInstance
- The element or selector that triggers the menu. Can also be set via the #activator slot.
- activatorPropsany
- openOnClickbooleantrue
- Opens the menu when the activator is clicked.
- openOnContextMenubooleanfalse
- Opens the menu on right-click (contextmenu event) instead of regular click.
- openOnHoverbooleanfalse
- Opens the menu when hovering the activator element.
- openOnFocusboolean
- closeOnContentClickbooleantrue
- Closes the menu when the user clicks inside its content area.
- closeDelaynumber | string
- openDelaynumber | string
- locationStrategyTLocationStrategy | TLocationStrategyFn
- locationTAnchor'bottom'
- Preferred position of the menu relative to the activator (top, bottom, left, right, start, end, and combinations).
- originTAnchor | 'auto' | 'overlap'
- offsetnumber | string | Array<number>
- Pixel offset from the activator. Pass [crossAxis, mainAxis] for two-axis control.
- viewportMarginnumber
- scrollStrategyTScrollStrategy | TScrollStrategyFn
- containedboolean
- eagerbooleanfalse
- Renders the menu content even when closed (useful for pre-fetching).
- transitionboolean | string | TTransitionProps'scale-transition'
- Enter/leave transition. Pass false to disable.
- scrimboolean | string
- attachboolean | string | Element | null
- activeClassstring
- expandIconstring
- collapseIconstring
- linesTLines
- slimboolean
- navboolean
- itemTypestring
- tagstring
- elevationTElevation
- Box-shadow elevation token applied to the menu panel. Default from token: {shadow.lg}.
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- densityTDensity
- sizeTSize | number
- Border-radius token applied to the menu panel.
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- selectStrategyTSelectStrategy | TSelectStrategyFn
- openStrategyTOpenStrategy | TOpenStrategyFns
- selectedArray<unknown>
- openedArray<unknown>
- mandatoryboolean
- itemsArray<any>[]
- Shorthand array of list-item props. Each entry renders an OrigamListItem. Nested items create sub-menus automatically.
- itemTitleTSelectItemKey
- itemValueTSelectItemKey
- itemChildrenTSelectItemKey
- itemPropsTSelectItemKey
- returnObjectboolean
- valueComparatortypeof deepEqual
- color
- Text color of the menu surface.
- bgColorTColor
- paddingboolean | number | string
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- marginboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- activeboolean
- linkboolean
- titlestring | number
- Optional subheader title rendered above the items list.
- valueany
- replaceboolean
- hrefstring
- exactboolean
- fontSizeTFontSize
- fontWeightTFontWeight
- lineHeightTLineHeight
- letterSpacingTLetterSpacing
- hoverboolean | IStateEffectConfig
- hoverClassstring
- subtitlestring | number
- rippleboolean | { class: string }
- toRouteLocationRaw
API
Slots
Content slots exposed by this component.
- #activator
- The element that triggers the menu. Bind the provided props to make the activator keyboard and ARIA-aware.
- #default
- Full replacement of the menu content. When provided, the items array and title are ignored.
API
Emits
Events emitted by this component.
- @contextmenuMouseEvent
- Bubbles the native contextmenu event from the activator, forwarded for parents that want to intercept right-click.
- @selectIListItemProps
- @update:modelValueany
- Fired when the menu opens or closes. Used for v-model binding.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Menu panel background color.
- Menu text color.
- Border-radius of the menu panel.
- Drop shadow applied to the menu panel.
- Maximum height before the menu becomes scrollable.
- Z-index of the menu overlay panel.
- Enter/leave transition duration.
- Inner padding of the menu content area.
- Maximum width of the menu content area.
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | Action |
|---|---|
| Escape | Closes the menu and returns focus to the activator. |
| ArrowDown | Moves focus to the next menu item. |
| ArrowUp | Moves focus to the previous menu item. |
| Enter / Space | Activates the focused menu item. |
| Tab | Closes the menu and moves focus to the next focusable element. |
Notes
- The activator element receives aria-haspopup="menu" and aria-expanded="true/false" bound by the overlay. The menu id is referenced via aria-owns.
- The menu panel has role="menu". Each item should carry role="menuitem" (provided automatically by OrigamListItem when inside a menu).
- Focus is trapped inside the menu when open. On close, focus returns to the activator element.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- colorvar(--origam-color__surface---raised)
- Menu panel background — inherits the raised surface token.
- dimensionvar(--origam-radius---md)
- Border radius of the menu panel.
- shadowvar(--origam-shadow---lg)
- Drop shadow applied to the floating panel.
- durationvar(--origam-motion__duration---fast)
- Enter/leave animation duration.
- numbervar(--origam-zIndex---dropdown)
- Stacking order of the floating menu panel.
- dimension320px
- Maximum width of the scrollable content inner area.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Basic menu
Nested sub-menu
Custom slot content