50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

yonder (version 0.0.5)

chipInput: A chips input

Description

A selectize alternative.

Usage

chipInput(id, choices, values = choices, selected = NULL, ...,
  max = NULL, fill = TRUE)

Arguments

id

A character string specifying the id of the reactive input.

choices

A character vector or list specifying the possible choices.

values

A character vector or list of strings specifying the input's values, defaults to choices.

selected

One or more of values specifying which values are selected by default.

...

Additional named arguments passed as HTML attributes to the parent element.

max

A number specifying the maximum number of items a user may select.

fill

One of TRUE or FALSE specifying the layout of chips. If TRUE chips fill the width of the parent element, otherwise if FALSE the chips are rendered inline, defaults to TRUE.

<strong>Example</strong> simple application

ui <- container(
  chipInput(
    id = "chips",
    choices = paste("Option number", 1:10),
    values = 1:10,
    fill = TRUE
  ) %>%
    width("1/2")
)

server <- function(input, output) {

}

shinyApp(ui, server)

<strong>Example</strong> inline chips

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)

See Also

Other inputs: buttonGroupInput, buttonInput, checkboxInput, fileInput, formInput, groupInput, listGroupInput, menuInput, navInput, radioInput, rangeInput, selectInput, sliderInput, textInput

Examples

Run this code
# NOT RUN {
### Default input

chipInput(
  id = "chip1",
  choices = paste("Choice", 1:5)
)

# }

Run the code above in your browser using DataLab