Preview Updated 2026-05-10

Context menu

A menu opened by right-click. Supports separators, shortcuts, and danger items, and is automatically clamped within the viewport.

Basic usage

Wrap a target region. After a right-click triggers the contextmenu event, the menu is shown at the cursor position. Esc or clicking outside closes it.

<CfContextMenu :items="items" @select="onPick">
<div>Right-click here</div>
</CfContextMenu>
<CfContextMenu items={items} onSelect={onPick}>
<div>Right-click here</div>
</CfContextMenu>

Disabled / danger / separator

disabled greys an item out, danger turns it red, and separator: true draws a divider row.

右键 → 查看完整菜单(含 disabled / danger / separator)
<CfContextMenu :items="items">…</CfContextMenu>
<CfContextMenu items={items}>…</CfContextMenu>

API

items: ContextMenuItem[]. Each entry supports:

FieldTypeDescription
labelstringText
valuestringValue emitted on select (falls back to label)
shortcutstringRight-aligned shortcut hint
disabledboolean
dangerbooleanRed styling
separatorbooleanDivider row (other fields ignored)

反馈与讨论

Context menu · Discussion

0
0 / 600
一键发送
正在加载评论...