ContextualMenu

Navigation
stable

Right-click context menu that opens at the cursor position. Wraps OrigamMenu with openOnContextMenu + target="cursor" + activator="cursor" preconfigured.

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

Anatomy of OrigamContextualMenuSchematic of the ContextualMenu component with numbered regions. Right-click zone (#activator) 1 2 Cut Copy Paste 3 ① = activator zone (v-bind="props"). ② = menu panel (role="menu"). ③ = menu items (#default slot).
Anatomy of <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 contextmenu event. Defined via the #activator slot 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 is fixed relative 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

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.

id
string
Unique id for the menu element (for ARIA associations).
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
absolute
boolean
closeOnBack
boolean
contentClass
string | Array<string>
contentProps
any
disabled
boolean
false
Prevents the context menu from opening on right-click.
noClickAnimation
boolean
modelValue
boolean
false
v-model controlling whether the context menu is open.
zIndex
number | string
CSS z-index for the menu overlay.
disableGlobalStack
boolean
persistent
boolean
height
number | string
maxHeight
number | string
Maximum height of the menu panel. Number is interpreted as px.
maxWidth
number | string
Maximum width of the menu panel. Number is interpreted as px.
minHeight
number | string
minWidth
number | string
Minimum width of the menu panel.
width
number | 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
activatorProps
any
openOnClick
boolean
openOnContextMenu
boolean
openOnHover
boolean
openOnFocus
boolean
closeOnContentClick
boolean
closeDelay
number | string
250
Delay in ms before the menu closes after the trigger condition is no longer met.
openDelay
number | string
0
Delay in ms before the menu opens after the right-click event.
locationStrategy
TLocationStrategy | TLocationStrategyFn
location
TAnchor
origin
TAnchor | 'auto' | 'overlap'
offset
number | string | Array<number>
viewportMargin
number
scrollStrategy
TScrollStrategy | TScrollStrategyFn
contained
boolean
eager
boolean
transition
boolean | string | TTransitionProps
Named transition applied to the menu panel when opening/closing.
scrim
boolean | string
attach
boolean | string | Element | null
activeClass
string
expandIcon
string
collapseIcon
string
lines
TLines
slim
boolean
nav
boolean
itemType
string
tag
string
elevation
TElevation
Box-shadow elevation for the menu panel.
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
density
TDensity
size
TSize | number
Border-radius token for the menu panel.
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
selectStrategy
TSelectStrategy | TSelectStrategyFn
openStrategy
TOpenStrategy | TOpenStrategyFns
selected
Array<unknown>
opened
Array<unknown>
mandatory
boolean
items
Array<any>
itemTitle
TSelectItemKey
itemValue
TSelectItemKey
itemChildren
TSelectItemKey
itemProps
TSelectItemKey
returnObject
boolean
valueComparator
typeof deepEqual
color
Intent or custom colour for the menu surface.
bgColor
TColor
padding
boolean | number | string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
margin
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
active
boolean
link
boolean
title
string | number
value
any
replace
boolean
href
string
exact
boolean
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight
letterSpacing
TLetterSpacing
hover
boolean | IStateEffectConfig
hoverClass
string
subtitle
string | number
ripple
boolean | { class: string }
to
RouteLocationRaw

API

Slots

Emplacements de contenu exposés par ce composant.

#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

Événements émis par ce composant.

@update:modelValue
boolean
Fired when the menu opens or closes.
@contextmenu
MouseEvent
Bubbles the native contextmenu event for parent interception.

API

Membres exposés

Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.

<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.

Personnalisation

Variables CSS

Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.

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

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

Rôles ARIA

menu
menuitem

Interactions clavier

Interactions clavier
ToucheAction
EscapeCloses the context menu and returns focus to the trigger element.
↑ / ↓Navigate between menu items.
Enter / SpaceActivates 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.

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Basic right-click menu

vue

Controlled open state

vue