AutoComplete
Description
Use AutoComplete
to provide a user with a list of selectable suggestions that appear when they type into the
input field. This list is populated by server search results.
Accessibility
Always set an accessible label to help the user interact with the component.
label_text
is required and visible by default.- If you must hide the label, set
visually_hide_label
totrue
. However, please note that a visible label should almost always be used unless there is compelling reason not to. A placeholder is not a label.
Arguments
Name | Required | Description |
---|---|---|
label_text | String The label of the input. | |
src | String The route to query. | |
input_id | String Id of the input element. | |
input_name | String Optional name of the input element, defaults to | |
list_id | String Id of the list element. | |
visually_hide_label | Boolean Controls if the label is visible. If | |
show_clear_button | Boolean Adds optional clear button. | |
system_arguments | Hash | |
size | Hash Input size can be small, medium (default), or large | |
full_width | Boolean Input can be full-width or fit to content | |
width | String Optional parameter to set max width of results list. One of | |
disabled | Boolean Disabled input | |
invalid | Boolean Invalid input | |
placeholder | String The placeholder text displayed within the input | |
inset | Boolean subtle input background color | |
monospace | Boolean monospace input font family |
Slots
results
Customizable results list.
Name | Required | Description |
---|---|---|
system_arguments | Hash |
leading_visual
Leading visual.
leading_visual_icon
for aPrimer::Beta::Octicon
.
Name | Required | Description |
---|---|---|
system_arguments | Hash Same arguments as |
input
Customizable input used to search for results. It is preferred to use this slot sparingly - it will be created by default if not explicity added.
Name | Required | Description |
---|---|---|
system_arguments | Hash |
AutoComplete::Item
Use AutoCompleteItem
to list results of an auto-completed search.
Arguments
Name | Required | Description |
---|---|---|
value | String Value of the item. | |
selected | Boolean Whether the item is selected. | |
disabled | Boolean Whether the item is disabled. | |
description_variant | Hash Changes the description style. Allowed values are :inline, :block | |
description | String Display description text below label | |
system_arguments | Hash |
Slots
leading_visual
The leading visual rendered before the link.
Name | Required | Description |
---|---|---|
kwargs | Hash The arguments accepted by |
trailing_visual
The trailing visual rendered after the link.
Name | Required | Description |
---|---|---|
kwargs | Hash The arguments accepted by |
description
Optional description
Name | Required | Description |
---|---|---|
system_arguments | Hash |
AutoComplete::NoResultItem
Slots
leading_visual
The leading visual rendered before the link.
Name | Required | Description |
---|---|---|
kwargs | Hash The arguments accepted by |
trailing_visual
The trailing visual rendered after the link.
Name | Required | Description |
---|---|---|
kwargs | Hash The arguments accepted by |
description
Optional description
Name | Required | Description |
---|---|---|
system_arguments | Hash |