shinyWidgets (version 0.3.0)

pickerInput: Select picker Input Control

Description

Create a select picker.

Usage

pickerInput(inputId, label = NULL, choices, selected = NULL,
  multiple = FALSE, options = NULL, choicesOpt = NULL, width = NULL,
  inline = FALSE)

Arguments

inputId

The input slot that will be used to access the value.

label

Display a text in the center of the switch.

choices

List of values to select from. If elements of the list are named then that name rather than the value is displayed to the user.

selected

The initially selected value (or multiple values if multiple = TRUE). If not specified then defaults to the first value for single-select lists and no values for multiple select lists.

multiple

Is selection of multiple items allowed?

options

Options to customize the select picker

choicesOpt

Options for choices in the dropdown menu

width

The width of the input : 'auto', 'fit', '100px', '75%'

inline

Put the label and the picker on the same line.

Value

A select control that can be added to a UI definition.

Examples

Run this code
# NOT RUN {
## Only run examples in interactive R sessions
if (interactive()) {

ui <- fluidPage(
  pickerInput(inputId = "somevalue", label = "A label", choices = c("a", "b")),
  verbatimTextOutput("value")
)
server <- function(input, output) {
  output$value <- renderPrint({ input$somevalue })
}
shinyApp(ui, server)
}
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab