pacocoursey / cmdk

Fast, unstyled command menu React component.
https://cmdk.paco.me
MIT License
9.42k stars 265 forks source link

Creating a combobox - `value` prop resets #90

Closed gino closed 1 year ago

gino commented 1 year ago

Hi there,

I am trying to create a Combobox in combination with the Radix UI popover component, where I want to have a specific item/value pre-selected. I could use the value prop on the Command component but unfortunately, as soon as I open the Combobox, the value resets to the first item again.

Is there any other way to have an item pre-selected, as the expected behaviour for a Combobox component. It seems quite difficult to create a Combobox using cmdk.

For example, I am using the example from the docs. Apple is the pre-selected value but this gets reset to Orange as soon as I close and re-open the menu.