Replies: 4 comments 11 replies
-
I would love to see an autocomplete input.
|
Beta Was this translation helpful? Give feedback.
-
Casting my vote for this feature as well! You could very well shove an Related: #372 |
Beta Was this translation helpful? Give feedback.
-
I needed a Listbox with autocomplete too and I came up with this solution:
So instead of using the default ListboxButton component I created my own ListboxInput component to open/close the Listbox:
The interesting lines are the first three in setup(), as this is kind of a hack to get the api Object from the Listbox component. The Listbox component uses the provide/inject api from vue to pass the api Object to its children. But the key to inject the api Object is a local Symbol. The first two lines are a workaround to get the reference to this Symbol so the api injection works. The api Object allows to open/close the Listbox programmatically. As this doesn't use the ListboxButton component, focus is fine. The component also passes the keydown events from the input to the ListboxOptions components so even the keyboard events do work. This should work similar with the Menu component. Strangely enough, this has been working fine so far but I also would love to see a built in autocomplete solution with Listbox and Menu. |
Beta Was this translation helpful? Give feedback.
-
Doesn't https://headlessui.dev/react/combobox solve this? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Can you add either an autocomplete input or allows to use Menu.Button as input?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions