Function to programmatically toggle the state of the controlbar
Function to programmatically toggle the state of the controlbar
updatebs4Controlbar(inputId, session)
inputId |
Controlbar id. |
session |
Shiny session object. |
if (interactive()) { library(shiny) library(bs4Dash) shiny::shinyApp( ui = dashboardPage( controlbar_collapsed = FALSE, controlbar_overlay = TRUE, navbar = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( actionButton(inputId = "controlbarToggle", label = "Toggle Controlbar") ), controlbar = dashboardControlbar(inputId = "controlbar") ), server = function(input, output, session) { observeEvent(input$controlbar, { if (input$controlbar) { showModal(modalDialog( title = "Alert", "The controlbar is opened.", easyClose = TRUE, footer = NULL )) } }) observeEvent(input$controlbarToggle, { updatebs4Controlbar(inputId = "controlbar", session = session) }) observe({ print(input$controlbar) }) } ) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.