ContextualMenu
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.
<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
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et 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
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:modelValueboolean
- Fired when the menu opens or closes.
- @contextmenuMouseEvent
- 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
Interactions clavier
| Touche | 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.
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
Controlled open state