Drawer

Navigation Drawers provide access to destinations in your app.

Usage

If you use two-way binding @bind-Open="...", you can toggle the Drawer and it will close itself on navigation. If you set its Open parameter without two-way binding, you effectively force it to stay open or closed, depending on the provided value.

Variants

The drawer can be displayed in many different ways, like other components you can set the different variants with Variant property but uses DrawerVariant enum.

Hide overlay

With parameter DisableOverlay, overlay can be turned off for Responsive and Temporary Drawers.

<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@(() => ToggleDrawer())">Toggle drawer</MudButton>

<MudDrawer @bind-Open="@open" DisableOverlay="true" Elevation="1" Variant="@DrawerVariant.Temporary">
    <MudDrawerHeader>
        <MudText Typo="Typo.h6">My App</MudText>
    </MudDrawerHeader>
    <MudNavMenu>
        <MudNavLink Match="NavLinkMatch.All">Store</MudNavLink>
        <MudNavLink Match="NavLinkMatch.All">Library</MudNavLink>
        <MudNavLink Match="NavLinkMatch.All">Community</MudNavLink>
    </MudNavMenu>
</MudDrawer>
@code{ 
    bool open;
    
    void ToggleDrawer()
    {
        open = !open;
    }
}

Copyright © 2020-2024 MudBlazor.

Powered by .NET 8.0.8

An error has occurred. This application may no longer respond until reloaded. Reload 🗙