valueBoxModule

valueBoxModule

valueboxModule does not have anything to do with user feedback, but we use it frequently, so we decided to include it in shinyFeedback.

valueBoxModule is similar to shinydashboard::valueBox() but it moves the value box UI from the server to the UI. Moving the value box UI to the UI has the benefit of only rendering the box once when the page is loaded rather than delaying the initial render until the initial value is calculated and rerendering the box each time that the value updates. By moving the box content to the UI, the value box does not flash onto the screen when rendered.

valueBoxModule also allows for more custom styling of the box colors than shinydashboard::valueBox().

library(shiny)
library(shinyFeedback)


server <- function(input, output, session) {

  count <- reactiveVal(0)

  observeEvent(input$counter_button, {
    count(count() + 1)
  })

  callModule(
    valueBoxModule,
    "betterBox",
    value = count
  )
}

ui <- fluidPage(
  fluidRow(
    column(
      12,
      actionButton(
        "counter_button",
        "+1"
      )
    )
  ),
  br(),
  fluidRow(
    valueBoxModuleUI(
      "betterBox",
      "Counter",
      icon = icon("rocket")
    )
  )
)


shinyApp(ui, server)


Try the shinyFeedback package in your browser

Any scripts or data that you put into this service are public.

shinyFeedback documentation built on Sept. 24, 2021, 5:07 p.m.