updateBoxPlus: Collapse a boxPlus tag.

Description Usage Arguments Examples

View source: R/boxes.R

Description

Collapse a boxPlus tag.

Usage

1
updateBoxPlus(inputId, session = shiny::getDefaultReactiveDomain())

Arguments

inputId

Box to toggle.

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
39
40
41
42
if (interactive()) {
 library(shiny)
 library(shinydashboard)
 library(shinydashboardPlus)
 
 ui <- dashboardPagePlus(
   dashboardHeaderPlus(),
   dashboardSidebar(),
   dashboardBody(
     tags$style("body { background-color: ghostwhite};"),
     
     br(),
     boxPlus(
       title = textOutput("box_state"),
       "Box body",
       inputId = "mybox",
       collapsible = TRUE,
       plotOutput("plot")
     ),
     actionButton("toggle_box", "Toggle Box", class = "bg-success")
   )
 )
 
 server <- function(input, output, session) {
   output$plot <- renderPlot({
     req(!input$mybox$collapsed)
     plot(rnorm(200))
   })
   
   output$box_state <- renderText({
     state <- if (input$mybox$collapsed) "collapsed" else "uncollapsed"
     paste("My box is", state)
   })
   
   observeEvent(input$toggle_box, {
     updateBoxPlus("mybox")
   })
   
 }
 
 shinyApp(ui, server)
}

dsciencelabs/shinydashboardPlus documentation built on Dec. 20, 2021, 2:10 a.m.