FreesearchR/reference/vectorSelectInput.md

1.6 KiB

A selectizeInput customized for named vectors

A selectizeInput customized for named vectors

Usage

vectorSelectInput(
  inputId,
  label,
  choices,
  selected = "",
  ...,
  placeholder = "",
  onInitialize
)

Arguments

Value

a selectizeInput dropdown element

Examples

if (shiny::interactive()) {
  shinyApp(
    ui = fluidPage(
      shiny::uiOutput("select"),
      tableOutput("data")
    ),
    server = function(input, output) {
      output$select <- shiny::renderUI({
        vectorSelectInput(
          inputId = "variable", label = "Variable:",
          data = c(
            "Cylinders" = "cyl",
            "Transmission" = "am",
            "Gears" = "gear"
          )
        )
      })

      output$data <- renderTable(
        {
          mtcars[, c("mpg", input$variable), drop = FALSE]
        },
        rownames = TRUE
      )
    }
  )
}
#> Error: 'interactive' is not an exported object from 'namespace:shiny'