Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing autocomplete on EuiComboBox #10

Open
mpRegalado opened this issue Jan 4, 2022 · 0 comments
Open

Implementing autocomplete on EuiComboBox #10

mpRegalado opened this issue Jan 4, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@mpRegalado
Copy link
Member

Description

For the country selector in the cloud console, the component ComboBox was used.
This had a feature where beginning to type the name of a country would select the first matching option.
In order to achieve this, the parameters passed to ComboBox's onSearchChange prop were altered from
(searchValue: string, hasMatchingOptions?: boolean) => void
to
(searchValue: string, hasMatchingOptions?: boolean, matchingOptions?: EuiComboBoxOptionOption<T>[]) => void
and an onSearchChange function was developed to manually select the first option of the array matchingOptions whenever the searchValue changed.

Proposed solutions

Add an autocomplete prop

This functionality could come by default from the component itself. Setting autocomplete to true would automatically select the first matching option.

Restore the matchingOptions parameter

Since onSearchChange only shows whether there was a match but not which results matched, adding this parameter to the function would allow for custom behaviors such as the autocomplete

@mpRegalado mpRegalado added the enhancement New feature or request label Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant