Combobox: Close dropdown if collection is empty #2181
sbennett33
started this conversation in
General
Replies: 1 comment 2 replies
-
You could implement this in your userland code // close when collection is empty
useEffect(() => {
if (options.length === 0) {
api.setOpen(false)
}
}, [options.length, api]) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When using the combobox with a dynamically updated list of items that list can sometimes be empty. If the collection on the combobox is set to an empty list the data-state should get set to closed. Right now if the data-state was open before the list was updated the data-state remains open and you are presented with an empty dropdown.
Beta Was this translation helpful? Give feedback.
All reactions