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

[Combobox] allow programatically changing the input value #491

Open
caymaynard opened this issue Sep 25, 2024 · 1 comment · May be fixed by #495
Open

[Combobox] allow programatically changing the input value #491

caymaynard opened this issue Sep 25, 2024 · 1 comment · May be fixed by #495

Comments

@caymaynard
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently there is no way to set the displayed input text of the Combobox. The value prop is expected to be a selectable option, so if I want to set the input to something else, it will result in nothing being displayed for the input text.

Describe the solution you'd like
As there is already a separate onInputChange prop for handling changes to the filter text, it would be good if there was also a prop, something like inputValue which can be used to set the filter text in a controlled manner.

Describe alternatives you've considered
The only other option is to add the text as an option. This may work for most scenarios, but is not always desirable.
Alternatively, a datalist can be used to turn a regular text input into a selectable list similar to a combobox (but much harder to style)

Additional context
The current combobox design seems to be like a filterable selection input.
That is one usecase for a combobox, but it can also be useful as a text input with some default options.
It would be great if Kobalte could support both usecases.

@AlexErrant AlexErrant linked a pull request Oct 4, 2024 that will close this issue
@mr-tech
Copy link

mr-tech commented Oct 12, 2024

I'm looking for controllable text input as well. For one of my components, I want to make an Combobox that asynchronously loads options based on the users query, but there's a lot of hidden behavior with the current Combobox implementation that clears the text input on certain interactions or prop changes. The most notable in my case is that the text clears when the options change making it impossible to asynchronously load options based on user input.

Another behavior that affects all my Combobox needs is that the text input clears when making a selection, so the user has to re-apply their filter if they want to add similar items.

Both of these behaviors could easily be implemented by a developer with a controlled input if they wanted, but there's little that can be done with the behavior that's currently baked in. I really like the Combobox component, particularly since virtualization was a major consideration. I just need to be able to control the text field, or be able to turn off all auto-clearing options. (Much preferably the former.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants