I built a brilliant application that has a fluid page and layout using sidebarPanel and mainPanel. Right now I am using a button that minimizes the sidebarPanel, but when this happens, the mainPanel keeps its width. I would like mainPanel to adjust to the new screen size and use the whole window instead of preserving the original 66% that it usually uses.
This is the button event that I use in the server.r file:
observeEvent(input$showpanel, {
if(input$showpanel == TRUE) {
shinyjs::show(id = "Sidebar")
shinyjs::enable(id = "Sidebar")
}
else {
shinyjs::hide(id = "Sidebar")
}
})
This is the button that I use in the ui.r file, which is now at the top of the mainPanel window.
mainPanel(
bsButton("showpanel", "Show/hide sidebar", type = "toggle", value = TRUE),
I don't know if there is a way to add CSS or HTML to the mainPanel when I hide the sidebarPanel.