Skip to contents

Create an autocomplete input with suggestions.

Usage

ds_suggestion(
  inputId,
  choices = NULL,
  value = "",
  placeholder = NULL,
  size = NULL,
  ...
)

Arguments

inputId

The input slot for Shiny reactivity

choices

Character vector of suggestion choices

value

Initial value

placeholder

Placeholder text

size

Size variant ("sm", "md", "lg")

...

Additional attributes

Value

A Shiny tag object

Examples

ds_suggestion("city",
  choices = c("Oslo", "Bergen", "Trondheim", "Stavanger"),
  placeholder = "Search for a city..."
)
#> <ds-suggestion id="city" class="ds-suggestion ds-shiny-input">
#>   <input id="city-input" data-shiny-no-bind-input type="text" class="ds-input" value="" placeholder="Search for a city..."/>
#>   <datalist id="city-list">
#>     <option value="Oslo"></option>
#>     <option value="Bergen"></option>
#>     <option value="Trondheim"></option>
#>     <option value="Stavanger"></option>
#>   </datalist>
#> </ds-suggestion>