I'm trying to collapse a box not only by reducing its height (default behavior) but also its width, so that the other box gets the extra space; a bit like a collapsible sidebar. How to achieve that?
In the below example, I'd like box 2 to be minimized, and box 1 to get the extra width freed by box 2:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
column(width = 12,
box(width = 9, "box 1"),
box(width = 3, "box 2", collapsible = T),
)
))
server <- function(input, output) {
}
shinyApp(ui, server)
Here is a JavaScript way, which could be improved to handle more situations.
Put the following JavaScript code in a file in the www subfolder of the app, name it sbsboxes.js.