updatebs4Controlbar: Function to programmatically toggle the state of the...

Description Usage Arguments Examples

View source: R/dashboardControlbar.R

Description

Function to programmatically toggle the state of the controlbar

Usage

1
updatebs4Controlbar(inputId, session)

Arguments

inputId

Controlbar id.

session

Shiny session object.

Examples

 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)
     })
   }
 )
}

RX-PBB/bs4Mash documentation built on April 11, 2020, 12:15 a.m.