Skip to contents

Update a number input from the server

Usage

update_shad_number_input(
  id,
  value = NULL,
  min = NULL,
  max = NULL,
  step = NULL,
  disabled = NULL,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

id

Input id (namespaced automatically).

value

Optional new value.

min, max, step

Optional numeric attribute patches.

disabled

Optional logical.

session

The Shiny session.

Value

Invisibly NULL.

Examples

if (interactive()) {
  ui <- page_shad(
    shad_number_input("qty", "Quantity", value = 1, min = 1, max = 10),
    shad_switch("bulk", "Bulk order")
  )
  server <- function(input, output, session) {
    shiny::observeEvent(input$bulk, {
      if (isTRUE(input$bulk)) {
        update_shad_number_input("qty", value = 10, max = 100, step = 10)
      } else {
        update_shad_number_input("qty", value = 1, max = 10, step = 1)
      }
    })
  }
  shiny::shinyApp(ui, server)
}