R/Shiny/bs4DashでValueBox


こんな感じ。

library(shiny)
library(bs4Dash)

ui <- bs4DashPage(
  navbar = bs4DashNavbar(),
  sidebar = bs4DashSidebar(),
  body = bs4DashBody(
    fluidRow(
      bs4ValueBox(
        value = iris$Sepal.Length[nrow(iris)],
        subtitle = "Sepal.Length",
        icon = "pie-chart",
        status = "primary",
        width = 8
      ),
      bs4ValueBoxOutput(
        outputId = "vb",
        width = 4
      )
    )
  ),
  controlbar = bs4DashControlbar(),
  footer = bs4DashFooter(),
  title = "yono2844"
)

server <- function(input, output, session) {
  output$vb <- renderbs4ValueBox(expr = {
    bs4ValueBox(
      value = iris$Sepal.Width[nrow(iris)],
      subtitle = "Sepal.Width",
      icon = "car",
      status = "info"
    )
  })
}

shinyApp(ui = ui, server = server)