Search code examples
blazornavigation-drawermudblazor

My Drawer with the NavMenu disappeared after updating MudBlazor


I just updated my app to MudBlazor version 1.1.2, and now my drawer is disappeared. Before it worked fine. My layout looks like so (removed some content for brevity):

<MudLayout DrawerOpen="@DrawerOpen">
    <MudAppBar Elevation="1">
        <MudIconButton Icon="@Icons.Material.Menu" Color="Color.Inherit" Edge="Edge.Start" 
               OnClick="@(()=>DrawerOpen=!DrawerOpen)" />
        <MudAppBarSpacer />
        <MudIconButton Icon="@Icons.Custom.GitHub" Color="Color.Inherit" />
    </MudAppBar>
    <MudDrawer Elevation="1">
        <MudDrawerHeader>
            <MudText Typo="Typo.h6">My Test App</MudText>
        </MudDrawerHeader>
        <MudNavMenu>
             ... my nav links here ...
        </MudNavMenu>
    </MudDrawer>
    <MudMainContent Class="pt-16 px-16">
        <MudContainer Class="mt-6">
            ... my main content here ...
        </MudContainer>
    </MudMainContent>
</MudLayout>

When I revert back to version 1.1.1 it works. I want to use the new version because it has theming support, so I can't revert. How do I get the drawer working again?


Solution

  • 1.1.2 introduces some breaking Changes. You need to set MudDrawer Open property to true

    <MudDrawer Open="true">

    or assign your variable DrawerOpen, to control if it's open or not

    <MudDrawer Open="@DrawerOpen">