5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-12 06:59:30 +08:00
wails/v3/examples/contextmenus
Lea Anthony 065ca5f6d3 Move to latest webkit2 and remove older code.
Fix screen demo.
Update examples.
2024-03-06 16:59:13 -06:00
..
assets Move to latest webkit2 and remove older code. 2024-03-06 16:59:13 -06:00
main.go [v3, assetServer] Remove fs.FS from options and always use a http.Handler 2024-02-16 07:38:27 +01:00
README.md Mac examples + readme updated 2023-10-17 20:25:36 +11:00

contextmenus

This example shows how to create a context menu for your application. It demonstrates window level and global context menus.

A simple menu is registered with the window and the application with the id "test". In our frontend html, we then use the --custom-contextmenu style to attach the menu to an element. We also use the --custom-contextmenu-data style to pass data to the menu callback which can be read in Go. This is really useful when using components to distinguish between different elements.


```html

<div class="region" id="123abc" style="--custom-contextmenu: test; --custom-contextmenu-data: 1">
    <h1>1</h1>
</div>
<div class="region" id="234abc" style="--custom-contextmenu: test; --custom-contextmenu-data: 2">
    <h1>2</h1>
</div>

Status

Platform Status
Mac Working
Windows Working
Linux