Description Usage Arguments Examples
Collapse a boxPlus tag.
1 | updateBoxPlus(inputId, session = shiny::getDefaultReactiveDomain())
|
inputId |
Box to toggle. |
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 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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.