AstrolUI AstrolUI
Yellow Orange Red Green Blue Purple Custom color
Light mode
LayoutMenu

Video tutorial

1. Demo AstrolLayoutMenu

Note
AstrolLayoutMenu is a Blazor component designed to completely replace the content of MainLayout.

@inherits LayoutComponentBase
@using Astrol.Component.Basic.Layout
@using Astrol.Entities.Basic.UI
<AstrolLayoutMenu Style="AstrolTheme.Yellow"
                  Mode="@mode"
                  ShowSetMode="true"
                  OnChangeThemeMode="m => mode = m"
                  StatusToggleMenu="@menuOpen"
                  OnChangeToggleMenu="open => menuOpen = open">
   <Top>
       <b>Options</b>
   </Top>
   <Menu>
       <b>Menu</b>
   </Menu>
   <Body>
       <div style="padding:20px;">
           @Body
       </div>
   </Body>
</AstrolLayoutMenu>
@code {
    // Light, Dark or Auto (follows the operating system)
    private AstrolThemeMode mode = AstrolThemeMode.Auto;
    private bool menuOpen = true;
}

Supported parameters

  • Top, Menu, Body (RenderFragment), content of the top bar, side menu and body.
  • Style (AstrolTheme), theme color (default Yellow): Yellow, Orange, Green, Blue, Red, Purple.
  • Mode (AstrolThemeMode?), color mode:
    • Light: light.
    • Dark: dark.
    • Auto: follows the operating system preference and changes live if the user changes it.
    When not set, Outline is used.
  • Outline (bool), classic mode: true light, false dark (default true). Ignored when Mode is set.
  • ShowSetMode (bool), shows the button to change the mode (default false). The button only reports the change: update Mode (or Outline) in the event.
  • OnChangeThemeMode (EventCallback<AstrolThemeMode>), when set, the button cycles light → dark → automatic. Store the value if you want to keep it after a reload.
  • OnChangeMode (EventCallback<bool>), classic two-state alternative (true = light); not raised when switching to automatic.
  • ApplyThemeToDocument (bool), also applies the theme to <html> so notifications and everything outside the layout use it (default true).
  • IncludeServiceHosts (bool), includes the IAstrolToast and IAstrolModal hosts (default true).
  • StatusToggleMenu (bool), side menu expanded (default true), and OnChangeToggleMenu (EventCallback<bool>), receives the new state when the button is pressed; the component does not change the value by itself, update it in this event.
  • WidthMenu (int), menu width in px (default 280); HeightTop (int), top bar height in px (default 50).
  • Class (string), custom css class.
  • It passes the cascading values ThemeStyle (AstrolTheme) and OutlineMode (bool, true = light) to its children.
  • SetOutline, the mode button, can also be used on its own: Mode (AstrolThemeMode), AllowAuto (bool), includes automatic mode in the cycle (default false), and OnChange (EventCallback<AstrolThemeMode>), receives the next mode.
Markdown for AI © 2026 AstrolUI v10.0.13