Toggling sidebars outside of the SidebarProvider #1604
jordihoven
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Related to: How to Close Sidebar on Item Click
Hi there,
I was toggling sidebars trough a custom Header component. However, simply following the docs and then toggling the
openvalue when an action in my header was clicked:However, this didn't open the mobile sidebar... So, I jumped into the
SidebarProviderand exposed it's toggleSidebar function (defineExpose({ toggleSidebar })). Then, I simply call this function whenever the header action is clicked.Not sure whether this is a 'clean' approach, or that i'm simply missing the 'correct' way of toggling the sidebar programatically.
For reference, here's the template of one of my views:
Would love to hear your ideas on toggling the sidebar from a custom header component.
-Jordi
Beta Was this translation helpful? Give feedback.
All reactions