1.16.8 of Anvil2, the Combobox has received quite a number of highly requested features and fixes!
A new select-only version of the Combobox
The newCombobox.Select component allows you to create a version of the Combobox that the user doesn’t type into, much like a native HTML select element. If you use this component, you should also use it with the Combobox.SelectTrigger child component (instead of Combobox.SearchField).
Most of the props are very similar between the regular Combobox and the Combobox.Select variant, though there are some small differences to be aware of. For instance, the Combobox.Select variant has no props regarding inputValue since it’s not an input field.
The Combobox popover can be kept open when selecting multiple items
The newdisableCloseOnSelectItem enables the Combobox to remain open after a user makes a selection. If you use this prop, we recommend pairing it with disableClearInputValueOnSelectItem to preserve the user’s search term as well.
The Combobox popover can be a different size from the search field
The newdisableMatchReferenceWidth allows the Combobox dropdown to conform to the width of the item content instead of matching the width of the input.
Combobox items can be compared by ID (instead of by reference)
TheCombobox defaults to comparing items by reference equality, but if you need your items to be compared by something like an id, you can enable this using the itemToKey prop:
Update combobox items dynamically
Dynamically updating the items array now works as expected. This is useful, for example, if you wanted to asynchronously load in new items:Use flex properties with combobox items
TheCombobox.Item component now works somewhat like a Flex component, so if you want to control the spacing in your Combobox.Item component, you can now directly use props like justifyContent and alignItems:
Set max rows greater than one in the search field
We’ve been working hard to fix bugs, such as making sure Combobox works smoothly with TypeScript
enums and inside shadow DOMs. And stay tuned—exciting new Combobox features are on the way, including the ability to add items that aren’t in the search, infinite loading, and integration with paginated backend endpoints.
Please continue to share your feedback and use cases so we can continue to enhance the Combobox!”