<!-- Generated by npm run gen:skill from ui/Menu/skill.md - do not edit. -->

# Menu

## `<menu>`

- `caption`
- actions: open
- events: Init

## `<item>`

- `value`, `icon`, `hotkeytext`, `submenu` (name of a menu in the same view), `checkable`, `checked`, `group`, `selected`
- actions: select, release
- events: Select, Release
- methods: getName, setSelect, toggleCheckable, setIcon

## `<divider>`

## `<dataitem>`

- `sort`, `display-empty`, `subicon`
- events: Select

## Guidance

```xml
<menu name="fileMenu">
  <item name="mNew" text="New" value="new"/>
  <divider/>
  <item name="mOpen" text="Open" value="open"/>
</menu>
<panel type="rows"><button name="file" text="File" submenu="fileMenu"/></panel>
```

- Each `menu` sits directly in the view, before the panel - never in a panel or another menu; a submenu is another menu, named by an item's `submenu`.
- Open it from a button (`submenu=`), or as a context menu: a trigger on a component's ContextMenu, then `<component name="fileMenu" action="open"/>` (`open` needs the triggering pointer or key event). Give a context menu `alt`.
- Trigger on the items (`component="mNew" event="Select"`); `{!}` is the item's `value`. Checkable items fire Select and Release; items with one `group` are radios.
- Items from data: `<dataitem name="recent"><rule match="file"><item text="{@name}"/></rule></dataitem>`, bound by its name to the rows' parent (`select="/files"` for `file` rows); trigger on its Select and read `{!#@name}`.
- `<divider title="Recent"/>` heads a section; a divider left at an edge hides itself. `hotkeytext` is a label only. An icon-only item needs `alt`.
