# tui/menu-set
Set the app menu bar from a map of menu-name → list of `%MenuItem{}`.
This is the low-level primitive for defining menus. Call it at any time with a
dynamically-constructed menu map — no `get-menu` function required. Use
`tui/menu-update` if you prefer to define a `get-menu` function and have the
workspace re-evaluate it automatically.
The host decides where the menu renders. By default (`ui/menu-bar :app`) it
sits in the panel's title bar; with `[config/set "ui/menu-bar" :global]` the
focused app's menu is hoisted into a single top workspace row and follows
panel focus. Setting `[config/set "ui/app-title-bars" false]` removes the
panel title strips entirely and forces the hoisted bar, so menus stay
reachable while app content owns the full panel. Menu items and their action
dispatch are unchanged in every mode. A locked application can pin title-bar
visibility with the prelude `:lockdown :title-bars` gate.
## Syntax
[tui/menu-set menus]
## Parameters
- `menus` — a map `%{ "File" @{ ... } "Edit" @{ ... } }` where each value is a
vector of `%MenuItem{ label "..." action "..." shortcut "..." }` tagged maps.
## Returns
`true` if the menu was parsed and stored successfully, `false` otherwise.
## Example
# Set a static menu [tui/menu-set %{ "File" @{ %MenuItem{ label "Open" action "menu-open" shortcut "Ctrl+O" } %MenuItem{ label "Save" action "menu-save" shortcut "Ctrl+S" } } "Edit" @{ %MenuItem{ label "Find" action "menu-find" shortcut "Ctrl+F" } } }] # Dynamically build a context-sensitive menu def make-menu {readonly^bool} { set items @{ %MenuItem{ label "Save" action "menu-save" shortcut "Ctrl+S" } } if (not $readonly) { set items (append $items %MenuItem{ label "Delete" action "menu-delete" shortcut "Del" }) } %{ "File" $items } } [tui/menu-set [make-menu false]]
## See also
- tui/menu-update — re-evaluate a `get-menu` function