Skip to content
Theme:

Ui3nMenu ​

Context menu component with customizable positioning and behavior.

Props

NameTypeDefaultDescription
idstring | undefined —

Root element id

widthstring | number | undefined"max-content"

Root element width

modelValueboolean | undefined —

Menu open state

triggerElementHTMLElement | Ui3nVirtualElement | undefined —

Trigger element

positionStrategy"absolute" | "fixed" | undefined"absolute"

Position strategy

positionAutoupdateboolean | undefined —

Whether to update position automatically

allowFlipboolean | undefinedtrue

Whether to allow flipping

lockScrollboolean | undefinedfalse

Whether to lock scroll when menu is open

offsetXnumber | undefined0

Offset X

offsetYnumber | undefined0

Offset Y

contentBorderRadiusnumber | number[] | undefined4

Content border radius

contentStylesRecord<string, string> | undefined —

Content styles

zIndexnumber | undefined1000

Z-index

closeOnClickboolean | undefinedtrue

Whether to close on click

closeOnClickOutsideboolean | undefinedtrue

Whether to close on click outside

disabledboolean | undefinedfalse

Whether menu is disabled

Events

Event NameArguments / Value TypeDescription
update:modelValuevalue: boolean —
clickvalue: Event —
close —
open —
opened —
closed —
click-outside —

Slots

Slot NameScope Props (v-slot)Description
#default —

Default slot

#menu —

Menu slot

Public Methods & Exposes

Method NameSignature / TypeDescription
isPositioned()boolean

Whether menu is positioned

update()() => void

Update position

CSS Variables

Set any of these where you need it — on :root, on a container, or on the element itself through [data-ui3n] — and the component follows. Leave them alone and it uses the defaults below.

NameDefault
--ui3n-menu-content-bgvar(--color-bg-control-secondary-default)
--ui3n-menu-content-border-radius4px
--ui3n-menu-z-index1000

Usage Examples ​

Simple menu ​

Simple menu

Basic menu with default trigger

Menu with custom offset

Menu with custom X and Y offsets

Controlled menu ​

Controlled menu

Menu with v-model for open state control

External state 'isOpen': false

Context menu by coordinates ​

Context menu by coordinates

Opening menu at mouse pointer coordinates using a virtual trigger element on right click

Right-click anywhere inside this dashed area to trigger the Context Menu