Open sdc50 opened 3 years ago
Hi @sdc50
Could you describe the use case?
should it be a method or a parameter like sidebar_open?
Could you describe the use case? should it be a method or a parameter like sidebar_open?
My use case is that I'd like the home page of my app to load without the sidebar open. I've made the header dynamic, so I don't want the side bar open while it's changing size.
My current approach is to use JavaScript to programatically trigger a click event on the sidebar hamburger toggle:
var nav_toggle = document.getElementsByClassName('mdc-top-app-bar__navigation-icon')[0];
if(document.getElementById('sidebar').classList.contains('mdc-drawer--open')){
nav_toggle.click();
}
I think a cleaner approach would be to specify that the sidebar should initialize as closed in Python.
In my opinion, this should just be a method rather than a parameter. That way the state doesn't require syncing every time the sidebar is toggled from the interface.
When using panel Templates I would like the ability to trigger the sidebar to open or close programmatically, similar to the
.open_modal()
and.close_modal()
methods. Could.open_sidebar()
and.close_sidebar()
methods be added?