Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

updatebs4Card

update an AdminLTE3 card from the server side


Description

update an AdminLTE3 card from the server side

Usage

updatebs4Card(
  inputId,
  session,
  action = c("remove", "toggle", "toggleMaximize", "restore")
)

Arguments

inputId

Card inputId

session

Shiny session

action

Action to trigger: c("remove", "toggle", "toggleMaximize", "restore").

Examples

if (interactive()) {
 library(shiny)
 library(bs4Dash)
 
 shiny::shinyApp(
   ui = dashboardPage(
     sidebar_collapsed = TRUE,
     navbar = dashboardHeader(),
     sidebar = dashboardSidebar(),
     body = dashboardBody(
       actionButton(inputId = "triggerCard", label = "Trigger Card Action"),
       selectInput(
         inputId = "cardAction", 
         label = "Card action", 
         choices = c(
           "remove",
           "toggle",
           "toggleMaximize",
           "restore"
         )
       ),
       
       bs4Card(
         inputId = "mycard",
         title = "The plot is visible when you maximize the card", 
         closable = TRUE, 
         maximizable = TRUE,
         width = 12,
         status = "warning", 
         solidHeader = FALSE, 
         collapsible = TRUE,
         sliderInput("obs", "Number of observations:",
                     min = 0, max = 1000, value = 500
         ),
         plotOutput("distPlot")
       )
     )
   ),
   server = function(input, output, session) {
     
     output$distPlot <- renderPlot({
       if (input$mycard$maximized) {
         hist(rnorm(input$obs)) 
       }
     })
     
     observeEvent(input$triggerCard, {
       updatebs4Card(inputId = "mycard", session = session, action = input$cardAction)
     })
     
     observe({
       print(
         list(
           collapsed = input$mycard$collapsed,
           maximized = input$mycard$maximized,
           visible = input$mycard$visible
         )
       )
     })
   }
 )
}

bs4Dash

A 'Bootstrap 4' Version of 'shinydashboard'

v0.5.0
GPL (>= 2) | file LICENSE
Authors
David Granjon [aut, cre], RinteRface [cph], Almasaeed Studio [ctb, cph] (AdminLTE3 theme for Bootstrap 4), Winston Chang [ctb, cph] (Utils functions from shinydashboard), Thomas Park [ctb, cph] (Bootswatch Sketchy theme CSS)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.