Path: blob/main/examples/reference/widgets/AutocompleteInput.ipynb
2011 views
The AutocompleteInput
widget allows selecting a value
from a list or dictionary of options
by entering the value into an auto-completing text field. It falls into the broad category of single-value, option-selection widgets that provide a compatible API and include the RadioBoxGroup
, Select
and DiscreteSlider
widgets.
Discover more on using widgets to add interactivity to your applications in the how-to guides on interactivity. Alternatively, learn how to set up callbacks and (JS-)links between parameters or how to use them as part of declarative UIs with Param.
Parameters:
For details on other options for customizing the component see the layout and styling how-to guides.
Core
options
(list or dict): A list or dictionary of options to select fromrestrict
(boolean,default=True
): Set to False in order to allow users to enter text that is not present in the options list.search_strategy
(str): Define how to search the list of completion strings. The default option"starts_with"
means that the user's text must match the start of a completion string. Using"includes"
means that the user's text can match any substring of a completion string.value
(str): The current value updated when pressing key; must be one of the option values if restrict=True.value_input
(str): The current value updated on every key press.case_sensitive
(boolean,default=True
): Enable or disable case sensitivity for matching completions.
Display
disabled
(boolean): Whether the widget is editablename
(str): The title of the widgetplaceholder
(str): A placeholder string displayed when no option is selectedmin_characters
(int,default=2
): The number of characters a user must type before completions are presented.
Like most other widgets, AutocompleteInput
has a value parameter that can be accessed or set:
If restrict=False
the AutocompleteInput
will allow any input in addition to the completions it offers:
The options
parameter also accepts a dictionary whose keys are going to be the labels of the dropdown menu.
Updating the value will display the right label.
Controls
The AutocompleteInput
widget exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively: