shinydashboard icon indicating copy to clipboard operation
shinydashboard copied to clipboard

request: update box properties

Open r2evans opened this issue 5 years ago • 2 comments

It would be nice to be able to change the title= or status= of a box based on another event.

ui <- dashboardPage(
  dashboardHeader(title="Hello World"),
  dashboardSidebar(
    box(
      id="box001",
      title="Temporary", status="warning",
      ...
    )
  ),
  dashboardBody(
    ...
  )
)
server <- function(input, output, session) {
  observeEvent(input$xyz, {
    updateBox("box001", title="Updated", status="success")
  })
}

It might require js to make change CSS real-time (e.g., by changing .box.box-solid.box-primary>.box-header).

r2evans avatar Jul 25 '18 20:07 r2evans

Any workarounds? Here is a relevant SO post:

https://stackoverflow.com/questions/51725295/r-shiny-color-of-boxes-depend-on-select

zx8754 avatar Aug 07 '18 16:08 zx8754

I like the renderUI suggestion as a workaround. If the box has anything "expensive" in it then this could be a little heavy-handed, but most of my use-case was simpler.

Thanks for making the connection :-)

r2evans avatar Aug 07 '18 17:08 r2evans