ContextualMenu
Right-click context menu that opens at the cursor position. Wraps OrigamMenu with openOnContextMenu + target="cursor" + activator="cursor" preconfigured.
Structure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-contextual-menu>. The component wraps OrigamMenu with openOnContextMenu + target="cursor" pre-configured. Menu panel positions at the exact cursor coordinates of the right-click.- 1activator zone
- The element or region that captures the
contextmenuevent. Defined via the#activatorslot or the parent element when no activator is provided. - 2.origam-contextual-menu (OrigamMenu root)
- Floating menu panel positioned at the cursor via
target="cursor". Background and box-shadow come from contextual-menu tokens. Position isfixedrelative to the viewport. - 3#default slot
- Menu content — typically an
<origam-list>with<origam-list-item>elements. Max-width is constrained by--origam-contextual-menu__content---max-width.
API
Props
All props accepted by this component, with their type, default value and description.
- idstring
- Unique id for the menu element (for ARIA associations).
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- absoluteboolean
- closeOnBackboolean
- contentClassstring | Array<string>
- contentPropsany
- disabledbooleanfalse
- Prevents the context menu from opening on right-click.
- noClickAnimationboolean
- modelValuebooleanfalse
- v-model controlling whether the context menu is open.
- zIndexnumber | string
- CSS z-index for the menu overlay.
- disableGlobalStackboolean
- persistentboolean
- heightnumber | string
- maxHeightnumber | string
- Maximum height of the menu panel. Number is interpreted as px.
- maxWidthnumber | string
- Maximum width of the menu panel. Number is interpreted as px.
- minHeightnumber | string
- minWidthnumber | string
- Minimum width of the menu panel.
- widthnumber | string
- Width of the menu panel. Number is interpreted as px.
- target'parent' | 'cursor' | TAnyString | Element | ComponentPublicInstance | [x: number, y: number] | undefined
- activator'parent' | 'cursor' | TAnyString | Element | ComponentPublicInstance
- activatorPropsany
- openOnClickboolean
- openOnContextMenuboolean
- openOnHoverboolean
- openOnFocusboolean
- closeOnContentClickboolean
- closeDelaynumber | string250
- Delay in ms before the menu closes after the trigger condition is no longer met.
- openDelaynumber | string0
- Delay in ms before the menu opens after the right-click event.
- locationStrategyTLocationStrategy | TLocationStrategyFn
- locationTAnchor
- originTAnchor | 'auto' | 'overlap'
- offsetnumber | string | Array<number>
- viewportMarginnumber
- scrollStrategyTScrollStrategy | TScrollStrategyFn
- containedboolean
- eagerboolean
- transitionboolean | string | TTransitionProps
- Named transition applied to the menu panel when opening/closing.
- scrimboolean | string
- attachboolean | string | Element | null
- activeClassstring
- expandIconstring
- collapseIconstring
- linesTLines
- slimboolean
- navboolean
- itemTypestring
- tagstring
- elevationTElevation
- Box-shadow elevation for the menu panel.
- 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 for 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>
- itemTitleTSelectItemKey
- itemValueTSelectItemKey
- itemChildrenTSelectItemKey
- itemPropsTSelectItemKey
- returnObjectboolean
- valueComparatortypeof deepEqual
- color
- Intent or custom colour for 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
- 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.
- #default
- Menu item content — typically a list of OrigamListItem elements.
- #activator
- The element that receives the right-click listener. Use when you need to define the trigger zone explicitly.
API
Emits
Events emitted by this component.
- @update:modelValueboolean
- Fired when the menu opens or closes.
- @contextmenuMouseEvent
- Bubbles the native contextmenu event for parent interception.
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to the underlying OrigamMenu.
- Ref<string>
- Reactive CSS string generated by useStyle.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet into the document.
- () => void
- Removes the injected style sheet.
- Ref<boolean>
- True once the style sheet has been injected into the DOM.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Background color of the menu panel.
- Foreground color of the menu panel.
- Border-radius of the menu panel.
- Box shadow (elevation) of the menu panel.
- Z-index of the menu panel. Appears above content but below modal-level surfaces.
- Maximum width of the menu content area.
- Open/close transition duration.
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | Action |
|---|---|
| Escape | Closes the context menu and returns focus to the trigger element. |
| ↑ / ↓ | Navigate between menu items. |
| Enter / Space | Activates the focused menu item. |
Notes
- The menu panel is positioned at the exact cursor coordinates of the right-click event via target="cursor". This matches the native browser context menu behaviour.
- On open, focus moves to the first enabled menu item. On close (Escape), focus returns to the element that received the right-click.
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 right-click menu
Controlled open state