IMenuBuilder
Interfacepublic interface IMenuBuilderFluent construction of a menu.
View sourceMethods
Appends a component to the body.
IMenuBuilder Add(IMenuComponent component)- componentIMenuComponentThe component to add.
Appends a component to the footer.
IMenuBuilder AddFooter(IMenuComponent component)- componentIMenuComponentThe component to add.
Appends a component to the header.
IMenuBuilder AddHeader(IMenuComponent component)- componentIMenuComponentThe component to add.
Declares an action available in this menu.
IMenuBuilder WithAction(MenuActionDescriptor descriptor)- descriptorMenuActionDescriptorThe action to declare.
Declaring an action whose name matches a built-in traversal action rebinds that action for this menu only.
Declares an action available in this menu, in the menu's own scope.
IMenuBuilder WithAction(string name, MenuKey defaultKey, string? label = null)Declares an action and gives it a menu-level handler, independent of whatever is focused.
IMenuBuilder WithAction(string name, MenuKey defaultKey, Func<MenuActionContext, ValueTask> handler, string? label = null)For a key that does something regardless of which row is selected — an extra shortcut alongside navigation and select, rather than a component's own reaction to being activated. The focused component is still offered the action first, through MenuActionContext), so declaring this under an existing action's name (such as "Select" ) only runs the handler when nothing else claims that press.
Closes an idle session automatically after a delay.
IMenuBuilder WithAutoClose(TimeSpan? delay)- delayTimeSpan?How long a session may sit idle before it closes, or null to disable.
Counted from when the session opens, not from the last input. Disabled by default.
Chooses how players interact with this menu.
IMenuBuilder WithInputMethod(MenuInputMethod inputMethod)- inputMethodMenuInputMethodThe input method.
Defaults to Chat for menus drawn by Chat and Buttons for every other renderer.
Adds a source of input method overrides for this menu.
IMenuBuilder WithInputMethodSource(IMenuInputMethodSource source)- sourceIMenuInputMethodSourceThe source to consult.
Use this to enforce an input method from a plugin's own configuration. The server-wide configuration still wins, since it registers at a higher priority.
Sets the largest number of body entries shown at once.
IMenuBuilder WithItemsPerPage(int itemsPerPage)- itemsPerPageintThe page size. Must be at least one.
An upper bound, not a guarantee. The server-wide line budget can cut the page down further, so entries that draw more than one line — spacers, multi-line components — leave room for fewer neighbours. This is what keeps the last entries of a long menu reachable instead of pushing them off screen.
Adds a source of key overrides for this menu.
IMenuBuilder WithKeybindSource(IMenuKeybindSource source)- sourceIMenuKeybindSourceThe source to consult.
Use this to bind actions from a plugin's own configuration. The server-wide configuration still wins, since it registers at a higher priority.
Sets the menu returned to when this one closes.
IMenuBuilder WithParent(IMenu parent)- parentIMenuThe parent menu.
Chooses the renderer this menu draws through.
IMenuBuilder WithRenderer(string rendererId)- rendererIdstringThe registered renderer id.
Defaults to CenterHtml. Building throws when the id is not registered.
Adds a source of renderer overrides for this menu.
IMenuBuilder WithRendererSource(IMenuRendererSource source)- sourceIMenuRendererSourceThe source to consult.
Use this to enforce a renderer from a plugin's own configuration. The server-wide configuration still wins, since it registers at a higher priority.
Adds a title line to the header.
IMenuBuilder WithTitle(string title)- titlestringThe title text.