Switch branches/tags
Nothing to show
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md rearrange order of shiny apps in readme Jun 13, 2016
app.R add many readmes and a few more examples May 10, 2016
shinydashboard-sidebar-hide.gif add gifs May 10, 2016

README.md

Hide/show shinydashboard sidebar programmatically

A common question regarding shinydashboard is how to programmatically hide/show the sidebar.

To solve this problem, I first looked at the HTML and tried to see what happens when the button to toggle the sidebar is clicked. It seems like the <body> HTML tag gains and loses a CSS class "sidebar-collapse" when the toggle button is clicked. Therefore, all we have to do to show/hide the sidebar is simply remove/add that class to the document's body tag. This can easily be done using the shinyjs package.


Demo