Skip to content

Context Menu ​

A menu of actions for an area, opened with a right click at the pointer (mouse / touchpad) or a long press at the finger (touch). Becomes a bottom sheet on compact touch screens.

Usage ​

Approximate web preview — the HarmonyOS rendering is the reference.

API ​

Extracted from the @Param / @Event / @BuilderParam declarations in the library sources.

SContextMenu ​

shadcn-vue ContextMenu: a menu opened on the trigger area with a right click (pointer, at the pointer position) or a long press (touch, at the finger). On compact touch screens it becomes a bottom sheet.

PropTypeDefaultDescription
disabledbooleanfalse
EventTypeDefaultDescription
onOpenChange(open: boolean) => void() => { }

Slots: children (trailing closure)

SContextMenuTrigger ​

The area that opens the menu: right mouse button → at the pointer; touch long-press (500 ms without moving more than 10 vp) → at the finger. Long-press uses a touch timer (a LongPressGesture loses to inner buttons).

Slots: children (trailing closure)

SContextMenuContent ​

bg-popover min-w-[8rem] rounded-md border p-1 shadow-md at the pointer; bottom sheet on compact touch.

PropTypeDefaultDescription
panelWidthnumber208panel width in vp (shadcn demo: w-52 = 208); rows size against it
adaptiveSparkAdaptive
SparkAdaptive = 'auto' | 'pointer' | 'touch'
'auto'

Slots: children (trailing closure)

SContextMenuItem ​

Action row; closes the menu after activation (unless keepOpen). Tap, click, Space / Enter and screen-reader activation fire onSelect (a .onClick() chained on the item does not fire).

PropTypeDefaultDescription
textResourceStr''
iconstring | undefinedundefined
shortcutstring | undefinedundefined
variantMenuItemVariant
MenuItemVariant = 'default' | 'destructive'
'default'
disabledbooleanfalse
insetbooleanfalse
keepOpenbooleanfalse
EventTypeDefaultDescription
onSelect() => void() => { }

SContextMenuCheckboxItem ​

PropTypeDefaultDescription
valuestring''identity for the uncontrolled memory (default: the label)
textResourceStr''
shortcutstring | undefinedundefined
checked!!boolean | undefinedundefined
defaultCheckedbooleanfalse
disabledbooleanfalse
EventTypeDefaultDescription
onCheckedChange(v: boolean) => void() => { }

SContextMenuRadioGroup ​

PropTypeDefaultDescription
namestring''identity for the uncontrolled memory (default: the defaultValue)
value!!string | undefinedundefined
defaultValuestring''
EventTypeDefaultDescription
onValueChange(v: string) => void() => { }

Slots: children (trailing closure)

SContextMenuRadioItem ​

PropTypeDefaultDescription
valuestring''
textResourceStr''
disabledbooleanfalse

SContextMenuLabel ​

PropTypeDefaultDescription
textResourceStr''
insetbooleanfalse

SContextMenuSeparator ​

No props.

SContextMenuGroup ​

Slots: children (trailing closure)

MIT Licensed