This is the server-side function for creating a dynamic
valueBox() or infoBox().
renderValueBox(expr, env = parent.frame(), quoted = FALSE)
renderInfoBox(expr, env = parent.frame(), quoted = FALSE)An expression that returns a Shiny tag object, HTML(),
or a list of such objects.
The parent environment for the reactive expression. By default,
this is the calling environment, the same as when defining an ordinary
non-reactive expression. If expr is a quosure and quoted is TRUE,
then env is ignored.
If it is TRUE, then the quote()ed value of expr
will be used when expr is evaluated. If expr is a quosure and you
would like to use its expression as a value for expr, then you must set
quoted to TRUE.
valueBoxOutput() for the corresponding UI-side function.
## Only run this example in interactive R sessions
if (interactive()) {
library(shiny)
ui <- dashboardPage(
dashboardHeader(title = "Dynamic boxes"),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(width = 2, actionButton("count", "Count")),
infoBoxOutput("ibox"),
valueBoxOutput("vbox")
)
)
)
server <- function(input, output) {
output$ibox <- renderInfoBox({
infoBox(
"Title",
input$count,
icon = icon("credit-card")
)
})
output$vbox <- renderValueBox({
valueBox(
"Title",
input$count,
icon = icon("credit-card")
)
})
}
shinyApp(ui, server)
}