Programmatically toggle a boxSidebar
updateBoxSidebar(id, session = shiny::getDefaultReactiveDomain())
id | Sidebar id. |
---|---|
session | Shiny session object. |
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), body = dashboardBody( box( title = "Update box sidebar", closable = TRUE, width = 12, height = "500px", solidHeader = FALSE, collapsible = TRUE, actionButton("update", "Toggle card sidebar"), sidebar = boxSidebar( id = "mycardsidebar", p("Sidebar Content") ) ) ), sidebar = dashboardSidebar() ), server = function(input, output, session) { observe(print(input$mycardsidebar)) observeEvent(input$update, { updateBoxSidebar("mycardsidebar") }) } ) }