We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Default Sidebar to closed on page load

Hey there,

Does anyone know how to default the Sidebar to closed when the page first loads?

I have tried doing it in the load and initialize events of the page but nothing seems to work.


3 Replies

SP Sowmiya Padmanaban Syncfusion Team November 27, 2019 01:12 PM UTC

Hi Nick, 
Thanks for contecting Syncfusion support. 
We have analyzed your requirement to close the sidebar element during initial rendering. In that case, you have to set the sidebar element type as “Push”. In that case, the sidebar is rendered in closed state. When you set type as Push in sidebar element, it will open sidebar in push mode even in mobile and desktop.  
Refer the below code snippet. 
<EjsSidebar Width="250px" @ref="sidebarObj" Type=SidebarType.Push> 
        <div style="text-align: center;" class="text-content"> Sidebar </div> 

To know more about the sidebar type, Refer the below link. 
Please let us know, if you have any concerns. 

FR Frank March 7, 2021 08:16 PM UTC

How does one make a docked sidebar display in the closed position on initial load of the page.  As shown here:


SP Sowmiya Padmanaban Syncfusion Team March 10, 2021 01:02 PM UTC

Hi Frank, 
You can enable the Dock by setting the EnableDock property and DockSize for Sidebar component.  
Note: Dock Sidebar is not applicable to the Sidebar type as Auto. 
<SfSidebar @ref="sidebarObj" Width="220px" DockSize="72px" Type=SidebarType.Slide EnableDock=true @bind-IsOpen="SidebarToggle"> 
Please, refer to the sample link:  
Please let us know, if you need any further assistance. 

Live Chat Icon For mobile
Up arrow icon