I built a Shiny application that has a fluidPage and a layout using the sidebarPanel and mainPanel. Right now I am using a button that minimizes the sidebarPanel but when that happens the mainPanel retains its width. What I would like to happen is the mainPanel adjusts to the new screen size and use the entire window instead of keeping the originall 66% it normally uses.
This is the button event that I am using 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 I am using in the ui.r file that is currently on the top of the mainPanel window.
mainPanel(
bsButton("showpanel", "Show/hide sidebar", type = "toggle", value = TRUE),
Don't know if there's a way to add css or HTML to the mainPanel window when I hide the sidebarPanel.