Description Usage Arguments Examples
update an AdminLTE3 card from the server side
1 2 3 4 5 | updatebs4Card(
inputId,
session,
action = c("remove", "toggle", "toggleMaximize", "restore")
)
|
inputId |
Card inputId |
session |
Shiny session |
action |
Action to trigger: |
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 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
)
)
})
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.