Dock in Blazor sidebar expanded by default

How can a dock Sidebar minimized by default.

Whether SidebarToggle is true or false, it always opens expanded in your example below.


1 Reply

VM Vishwanathan Muruganantham Syncfusion Team October 14, 2024 04:35 PM UTC

Hi Yongkee,


We have validated your query and understand that the sidebar remains open even when “sidebarToggle” is set to false. To resolve this issue, you need to set the “Type” property of the Sidebar to other than “Auto”. By default, Type is set to Auto, which means the Sidebar uses the “Over” type in mobile resolution and the “Push” type in higher resolutions.


Refer to the below code snippet for reference.




<SfSidebar @ref="sidebarObj" Width="220px" DockSize="72px" EnableDock=true @bind-IsOpen="SidebarToggle" Type="SidebarType.Over">

    <ChildContent>

        <div class="dock">

            <ul>

                <li class="sidebar-item" id="toggle" @onclick="Toggle">

….


Please check the sample and let us know if you need any further assistance.


Sample: attached as zip folder.


Best Regards,
Vishwanathan


Attachment: DockOver_877212c3.zip

Loader.
Up arrow icon