chipInput.Rd
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() )
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 |
selected | One or more of |
... | Additional named arguments passed as HTML attributes to the parent element or tag elements passed as child elements to the parent element. |
placeholder | A character string specifying placeholder text of the
chip input, defaults to |
max | A number specifying the maximum number of items a user may select,
defaults to |
inline | One of |
sort | One of
|
enable | One of |
disable | One of |
session | A reactive context, defaults to |
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()
### Default input chipInput( id = "chip1", choices = paste("Choice", 1:5), selected = c("Choice 3", "Choice 4") )#> <div id="chip1" class="yonder-chip btn-group dropup" data-max="-1" data-sort="stack"> #> <input class="form-control custom-select" data-toggle="dropdown"/> #> <div class="dropdown-menu"> #> <button class="dropdown-item" value="Choice 1">Choice 1</button> #> <button class="dropdown-item" value="Choice 2">Choice 2</button> #> <button class="dropdown-item selected" value="Choice 3">Choice 3</button> #> <button class="dropdown-item selected" value="Choice 4">Choice 4</button> #> <button class="dropdown-item" value="Choice 5">Choice 5</button> #> </div> #> <div class="chips chips-inline chips-grey"> #> <button class="chip" value="Choice 1"> #> <span class="chip-content">Choice 1</span> #> <span class="chip-close">×</span> #> </button> #> <button class="chip" value="Choice 2"> #> <span class="chip-content">Choice 2</span> #> <span class="chip-close">×</span> #> </button> #> <button class="chip active" value="Choice 3"> #> <span class="chip-content">Choice 3</span> #> <span class="chip-close">×</span> #> </button> #> <button class="chip active" value="Choice 4"> #> <span class="chip-content">Choice 4</span> #> <span class="chip-close">×</span> #> </button> #> <button class="chip" value="Choice 5"> #> <span class="chip-content">Choice 5</span> #> <span class="chip-close">×</span> #> </button> #> </div> #> </div>