Menubar

A row of menus, like a desktop app's File, Edit and View.

Installation

bash
shellui-native add menubar

Platforms: MAUI · Avalonia. Also installs icon.

Usage

Basic

Rendered with ShellUI for Blazor

Last action: none

<ui:Menubar>
    <ui:MenubarMenu Title="File">
        <ui:MenubarItem Text="New tab" Shortcut="Ctrl+T" Clicked="OnMenuItem" />
        <ui:MenubarItem Text="New window" Shortcut="Ctrl+N" Clicked="OnMenuItem" />
        <ui:MenubarSeparator />
        <ui:MenubarItem Text="Print" Icon="FileText" Shortcut="Ctrl+P" Clicked="OnMenuItem" />
    </ui:MenubarMenu>
    <ui:MenubarMenu Title="Edit">
        <ui:MenubarItem Text="Undo" Icon="Undo2" Clicked="OnMenuItem" />
        <ui:MenubarItem Text="Redo" Icon="Redo2" Clicked="OnMenuItem" />
        <ui:MenubarSeparator />
        <ui:MenubarItem Text="Copy" Icon="Copy" Clicked="OnMenuItem" />
        <ui:MenubarItem Text="Delete" Icon="Trash2" IsDestructive="True" Clicked="OnMenuItem" />
    </ui:MenubarMenu>
    <ui:MenubarMenu Title="View">
        <ui:MenubarItem Text="Reload" Icon="RefreshCw" Clicked="OnMenuItem" />
        <ui:MenubarItem Text="Full screen" IsEnabled="False" />
    </ui:MenubarMenu>
</ui:Menubar>
Avalonia, running in your browser

Each menu opens a panel of items under its title. Clicking outside, picking an item or pressing Escape closes it, and opening one menu closes the other. Shortcut is a hint at the end of the row; it doesn't register a key.

MAUI and Avalonia

  • On Avalonia the titles are tab stops: Enter, Space or Down opens a menu, and Left / Right move between titles.
  • In an open Avalonia menu, Up / Down move between the items and Enter picks one.
  • On Avalonia the menus are collected in Menus and a menu's items in Items.

API

XAML children go to Menus.

No properties of its own.

XAML children go to Items.

Property Type Default Description
Title string — The menu's name in the bar.
Event Arguments Description
Opened — The menu opened.
Closed — The menu closed.
Method Description
SetOpen(bool open) Opens or closes it.
Close() Closes it.
Property Type Default Description
Text string — Item text.
Icon IconName None Lucide icon from IconName; None for no icon.
Shortcut string — Keyboard hint shown at the end of the row (display only).
IsDestructive bool false Draws the item in the destructive colour.
Event Arguments Description
Clicked — Clicked or tapped (or Enter / Space with keyboard focus).
Method Description
Press() Picks the item in code, as a click or Enter/Space would. Avalonia only.

No properties of its own.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.