Shiny - dashboardPage - how can I add a button to box header

Viewed 3426

Using dashboardPage I made a dashboard made out of boxes.

I would like to be able to click somewhere on the header of a box to trigger some action. The only case I know where the header has a button is the case of expandable boxes. Would it be possible to generalize that so that, upon a click somewhere in the header of a box, some action is triggered?

My design goal is to have the info in the box update when the user clicks on this button, i.e., to have the content of the box change.

Thanks!

body <- dashboardBody(
  fluidRow(
    box(
      title = "Title 1", width = 4, solidHeader = TRUE, status = "primary",
      "Box content"
    ),
    box(
      title = "Title 1", width = 4, solidHeader = TRUE, status = "warning",
      "Box content"
    )
  )
)
# We'll save it in a variable `ui` so that we can preview it in the console
ui <- dashboardPage(
  dashboardHeader(title = "Row layout"),
  dashboardSidebar(),
  body
)
# Preview the UI in the console
shinyApp(ui = ui, server = function(input, output) { })
1 Answers
Related