MenuItem record Core
One row of a MenuOverlayContent: a clickable entry (optionally check-marked / disabled / danger) or a separator. MenuItem.Icon draws in the left gutter when the entry is NOT checked (e.g. the operator glyph); a checked entry shows a ✓ there instead — same as the classic menu. MenuItem.ClosesMenu (default true) decides whether picking the entry also dismisses the menu — set it false for entries you keep clicking (toggles, an option you want to compare), so the dev owns that behaviour per entry.
public sealed record MenuItem
- Namespace
- ArionUI.Presentation.Overlay
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease
Constructors
MenuItem
public MenuItem(string Label, Action? OnClick = null, bool? Checked = default, bool Enabled = true, bool IsSeparator = false, Action<IRenderSurface, LogRect, Rgba>? Icon = null, bool Danger = false, bool ClosesMenu = true, Func<bool>? LiveChecked = null, bool OpensSubMenu = false);One row of a MenuOverlayContent: a clickable entry (optionally check-marked / disabled / danger) or a separator. MenuItem.Icon draws in the left gutter when the entry is NOT checked (e.g. the operator glyph); a checked entry shows a ✓ there instead — same as the classic menu. MenuItem.ClosesMenu (default true) decides whether picking the entry also dismisses the menu — set it false for entries you keep clicking (toggles, an option you want to compare), so the dev owns that behaviour per entry.
Properties
Checked
public bool? Checked { get; init; }
CheckedNow
public bool? CheckedNow { get; }Check state at DRAW time: MenuItem.LiveChecked wins over the static MenuItem.Checked, so an entry that toggles engine state shows the truth without the menu being rebuilt (the legacy MenuEntry had exactly this).
ClosesMenu
public bool ClosesMenu { get; init; }
Danger
public bool Danger { get; init; }
Enabled
public bool Enabled { get; init; }
Icon
public Action<IRenderSurface, LogRect, Rgba>? Icon { get; init; }
IsSeparator
public bool IsSeparator { get; init; }
Label
public string Label { get; init; }
LiveChecked
public Func<bool>? LiveChecked { get; init; }
OnClick
public Action? OnClick { get; init; }
OpensSubMenu
public bool OpensSubMenu { get; init; }
Methods
Separator
public static MenuItem Separator();
