The chip input is a selectize alternative. Choices are selected from a
dropdown menu and appear as chips below the input's text box. Chips do not
appear in the order they are selected. Instead chips are shown in the order
specified by the choices argument. Use the max argument to limit the
number of choices a user may select.
chipInput(
  id,
  choices = NULL,
  values = choices,
  selected = NULL,
  ...,
  placeholder = NULL,
  max = Inf,
  inline = TRUE,
  sort = "stack"
)updateChipInput(
  id,
  choices = NULL,
  values = choices,
  selected = NULL,
  max = NULL,
  enable = NULL,
  disable = NULL,
  session = getDefaultReactiveDomain()
)
A character string specifying the id of the reactive input.
A character vector or list specifying the possible choices.
A character vector or list of strings specifying the input's
values, defaults to choices.
One or more of values specifying which values are selected
by default.
Additional named arguments passed as HTML attributes to the parent element or tag elements passed as child elements to the parent element.
A character string specifying placeholder text of the
chip input, defaults to NULL.
A number specifying the maximum number of items a user may select,
defaults to Inf.
One of TRUE or FALSE specifying if chips are rendered
inline. If TRUE multiple chips may fit onto a single row, otherwise, if
FALSE, chips expand to fill the width of their parent element, one chip
per row.
One of "stack", "queue", or "fixed" specifying how
selected chips are ordered, defaults to "stack".
"stack", selected chips are placed ahead of other selected chips.
"queue", selected chips are placed behind other selected chips.
"fixed", selected chips appear in the order specified by
choices and values. Use "fixed" and sort choices to keep selected
chips in the same sorted order.
One of values specifying particular choices to enable or
TRUE specifying the entire input is enabled, defaults to NULL.
One of values specifying particular choices to disable or
TRUE specifying the entire input is disabled, defaults to NULL.
A reactive context, defaults to getDefaultReactiveDomain().
ui <- container(
  chipInput(
    id = "chips",
    choices = paste("Option number", 1:10),
    values = 1:10,
    inline = TRUE
  ) %>%
    width("1/2")
)server <- function(input, output) {
}
shinyApp(ui, server)
ui <- container(
  chipInput(
    id = "chips",
    choices = c(
      "A rather long option, isn't it?",
      "Shorter",
      "A middle-size option",
      "One more"
    ),
    values = 1:4,
    fill = FALSE
  ) %>%
    width("1/2") %>%
    background("blue") %>%
    shadow("small")
)server <- function(input, output) {
}
shinyApp(ui, server)
Other inputs: 
buttonGroupInput(),
buttonInput(),
checkbarInput(),
checkboxInput(),
fileInput(),
formInput(),
listGroupInput(),
menuInput(),
navInput(),
radioInput(),
radiobarInput(),
rangeInput(),
selectInput(),
textInput()
# NOT RUN {
### Default input
chipInput(
  id = "chip1",
  choices = paste("Choice", 1:5),
  selected = c("Choice 3", "Choice 4")
)
# }
Run the code above in your browser using DataLab