Description Usage Arguments Examples
View source: R/dashboardControlbar.R
Function to programmatically toggle the state of the controlbar
1 | updatebs4Controlbar(inputId, session)
|
inputId |
Controlbar id. |
session |
Shiny session object. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 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)
})
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.