updatebs4CardSidebar: Programmatically toggle a bs4Card sidebar

Description Usage Arguments Examples

View source: R/update-functions.R

Description

Programmatically toggle a bs4Card sidebar

Alias to updatebs4CardSidebar See updatebs4CardSidebar for full details

Usage

1
2
3
updatebs4CardSidebar(session, inputId)

updateCardSidebar(session, inputId)

Arguments

session

Shiny session object.

inputId

Card sidebar id.

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
39
if (interactive()) {
 library(shiny)
 library(bs4Dash)
 
 shinyApp(
  ui = bs4DashPage(
    sidebar_collapsed = FALSE,
    controlbar_collapsed = TRUE,
    enable_preloader = FALSE,
    navbar = bs4DashNavbar(skin = "dark"),
    body = bs4DashBody(
      bs4Card(
        title = "Closable Box with gradient", 
        closable = TRUE, 
        width = 12,
        height = "500px",
        solidHeader = FALSE, 
        collapsible = TRUE,
        actionButton("update", "Toggle card sidebar"),
        sidebar = bs4CardSidebar(
          inputId = "mycardsidebar",
          p("Sidebar Content")
        )
      )
    ),
    sidebar = bs4DashSidebar(),
    controlbar = bs4DashControlbar(),
    footer = bs4DashFooter()
  ),
  server = function(input, output, session) {
    observe(print(input$mycardsidebar))
    
    observeEvent(input$update, {
      updatebs4CardSidebar(session, inputId = "mycardsidebar")
    })
    
  }
 )
}

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