carbon-design-system / carbon-components-svelte

Svelte implementation of the Carbon Design System
https://svelte.carbondesignsystem.com
Apache License 2.0
2.68k stars 261 forks source link

ComboBox: add ability to type arbitrary values that weren't provided in `items` #1943

Open McGaelen opened 6 months ago

McGaelen commented 6 months ago

This change implements #1726 by allowing users to type in any text they want into a ComboBox, without having it removed. This functionality is behind a new flag, called allowArbitraryValues. The default is false, which means that the ComboBox will continue to function the same as it did before if the user does not enable it.

When the value is not present in items (it is an arbitrary value), the value of selectedId will be undefined.

Please let me know what changes are needed. If a separate component is desired instead, I'm happy to make the change.

Thanks!