The ContextMenu
component is used to create a context menu.
import live-web.dom
import live-web-view.button
import live-web-view.overlay
static any[] use = [PrimaryButton, ContextMenu]
ContextMenu{ id: contextMenu }
PrimaryButton{
T`Open Context Menu`
on click: (e) => {
e.preventDefault()
contextMenu.show(
{ x: e.clientX, y: e.clientY },
ContextMenuActionsView.create([
{ label: 'Item 1', action: () => {}},
{ label: 'Item 2', action: () => {}},
{ label: 'Item 3', action: () => {}}
])
)
}
}
import live-web.dom
import live-web-view.button
import live-web-view.overlay
static any[] use = [PrimaryButton, ContextMenu, Content]
ContextMenu{ id: contextMenu }
PrimaryButton{
T`Open Context Menu`
on click: (e) => {
e.preventDefault()
contextMenu.show(
{ x: e.clientX, y: e.clientY },
Content{
P`Context Menu Content`
}
)
}
}
import live-web.dom
import live-web-view.button
import live-web-view.overlay
static any[] use = [PrimaryButton, ContextMenu, Content]
ContextMenu{ id: contextMenu }
Content{
P{
T`Right click `
A{
T`here`
on contextmenu: (e) => {
e.preventDefault()
contextMenu.show(
{ x: e.clientX, y: e.clientY },
ContextMenuActionsView.create([
{ label: 'Item 1', action: () => {}},
{ label: 'Item 2', action: () => {}},
{ label: 'Item 3', action: () => {}}
])
)
}
}
T` to open context menu.`
}
}