Select which input controllers should be treated as one. Use `commonInput` to group selected controllers or `commonInputs` to group multiple controllers at once.

commonInput(inputId, controller, block = TRUE, ignoreIds = NULL)

commonInputs(inputId, ..., block = TRUE, ignoreIds = NULL)

Arguments

inputId

Id to be used to send the grouped controllers input values to application server.

controller

Shiny input controller e.g. `shiny::sliderInput` or `shinyWidgets::pickerInput`.

block

Should the `controller` input value be sent to the server independently?

ignoreIds

Precise input IDs of bindings that should be ignored. Leave NULL (default) to catch all.

...

Input controllers to be grouped in case of using `commonInputs`.

Examples

if (interactive()) {
  library(shiny)

  ui <- fluidPage(
    commonInput("val", selectInput("letter", "Letter", letters)),
    commonInput("val", numericInput("number", "Number", min = 0, max = 10, value = 1)),
    commonInputs(
      "val2",
      selectInput("letter2", "Letter", letters),
      numericInput("number2", "Number", min = 0, max = 10, value = 1)
    )
  )

  server <- function(input, output, session) {
    observeEvent(input$val, {
      print(input$val)
    })
    observeEvent(input$val2, {
      print(input$val2)
    })
  }

  shinyApp(ui, server)
}