Menu

Overlay & Surface
stable

Floating contextual menu anchored to an activator element. Supports nested sub-menus, keyboard navigation, items array shorthand, and full slot customisation.

Structure

Anatomie

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

Anatomy of OrigamMenuSchematic of the Menu component with 5 numbered parts. Activator origam-menu__title (subheader) origam-menu__item (list-item) origam-menu__item (hover) origam-menu__item 1 2 3 4 5
Anatomy of <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

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

id
string
HTML id applied to the overlay root and referenced by aria-owns on the activator.
absolute
boolean
closeOnBack
boolean
true
Closes the menu when the user presses Escape or navigates back.
contentClass
string | Array<string>
contentProps
any
disabled
boolean
noClickAnimation
boolean
modelValue
boolean
false
Controls the open/closed state. Use v-model to sync with parent.
zIndex
number | string
disableGlobalStack
boolean
persistent
boolean
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
height
number | string
maxHeight
number | string
Maximum height before the menu becomes scrollable. Default: calc(100vh - 32px) from the token.
maxWidth
number | string
Maximum width of the menu surface.
minHeight
number | string
minWidth
number | string
Minimum width of the menu surface. Defaults to the activator width when unset.
width
number | 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.
activatorProps
any
openOnClick
boolean
true
Opens the menu when the activator is clicked.
openOnContextMenu
boolean
false
Opens the menu on right-click (contextmenu event) instead of regular click.
openOnHover
boolean
false
Opens the menu when hovering the activator element.
openOnFocus
boolean
closeOnContentClick
boolean
true
Closes the menu when the user clicks inside its content area.
closeDelay
number | string
openDelay
number | string
locationStrategy
TLocationStrategy | TLocationStrategyFn
location
TAnchor
'bottom'
Preferred position of the menu relative to the activator (top, bottom, left, right, start, end, and combinations).
origin
TAnchor | 'auto' | 'overlap'
offset
number | string | Array<number>
Pixel offset from the activator. Pass [crossAxis, mainAxis] for two-axis control.
viewportMargin
number
scrollStrategy
TScrollStrategy | TScrollStrategyFn
contained
boolean
eager
boolean
false
Renders the menu content even when closed (useful for pre-fetching).
transition
boolean | string | TTransitionProps
'scale-transition'
Enter/leave transition. Pass false to disable.
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 token applied to the menu panel. Default from token: {shadow.lg}.
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 applied to 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>
[]
Shorthand array of list-item props. Each entry renders an OrigamListItem. Nested items create sub-menus automatically.
itemTitle
TSelectItemKey
itemValue
TSelectItemKey
itemChildren
TSelectItemKey
itemProps
TSelectItemKey
returnObject
boolean
valueComparator
typeof deepEqual
color
Text color of 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
Optional subheader title rendered above the items list.
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.

#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

Événements émis par ce composant.

@contextmenu
MouseEvent
Bubbles the native contextmenu event from the activator, forwarded for parents that want to intercept right-click.
@select
IListItemProps
@update:modelValue
any
Fired when the menu opens or closes. Used for v-model binding.

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.

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

Accessibilité

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

Rôles ARIA

menu

Interactions clavier

Interactions clavier
ToucheAction
EscapeCloses the menu and returns focus to the activator.
ArrowDownMoves focus to the next menu item.
ArrowUpMoves focus to the previous menu item.
Enter / SpaceActivates the focused menu item.
TabCloses 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.

Fondation

Design tokens

Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.

Source
color
var(--origam-color__surface---raised)
Menu panel background — inherits the raised surface token.
dimension
var(--origam-radius---md)
Border radius of the menu panel.
shadow
var(--origam-shadow---lg)
Drop shadow applied to the floating panel.
duration
var(--origam-motion__duration---fast)
Enter/leave animation duration.
number
var(--origam-zIndex---dropdown)
Stacking order of the floating menu panel.
dimension
320px
Maximum width of the scrollable content inner area.

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 menu

vue

Nested sub-menu

vue

Custom slot content

vue