Sidebar always Opened by default

Hi,
I have an issue with RadzenSidebar, is alway by default open, when i bind a false boolean.

I am on Blazor SSR .net8 and Radzen.Blazor 7.2 (and under)

An example of my code:

<RadzenLayout Style="grid-template-columns: 1fr auto; grid-template-areas: 'rz-header rz-header' 'rz-body rz-sidebar'; height: 90%; background-color: inherit">
  <RadzenSidebar @bind-Expanded="@helpSidebarExpanded">
  <!-- or with: <RadzenSidebar Expanded="false"> -->
    ....
  </RadzenSidebar>
  
  <RadzenBody>
    ....
  </RadzenBody>

</RadzenLayout>

It's as if the component has a default state of True and forces the Expanded parameter to change to its default value.

My goal is to have a collapsed sidebar when the user arrives on my page, and open sidebar when user click on a button.

Is this a bug or expected behavior?

Hi @BenjaminFourmaux

Check out the example here for Overlay Sidebar.

You'll see that it sets the property Responsive="false"

In effect, you are setting the menu to false, but the Responsive behaviour will automatically open it. This disables that from happening.

Regards

Paul

2 Likes

Hi @Paul_Ruston

Thank you for your reply,

Indeed, the parameter Responsive="False" on RadzenSidebar is the solution