shinydashboard
shinydashboard copied to clipboard
request: update box properties
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
).
Any workarounds? Here is a relevant SO post:
https://stackoverflow.com/questions/51725295/r-shiny-color-of-boxes-depend-on-select
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 :-)