-
I have item { item1, item2, item3 } in the combobox and while displaying I want item2 to be preselected. User should be able to change the combobox item to item3 by clicking and selecting the item3. Issue: when I am setting value=item2 and onChange={()=>{ /* update the variable to item 3*/}} example:
Input |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @aratn. Thanks for the discussion topic here. What I'm noticing in your example snippet is that you're using a As for a solution, if you would prefer to allow the DOM to manage the updates (uncontrolled) you can provide a default with a |
Beta Was this translation helpful? Give feedback.
Hi @aratn. Thanks for the discussion topic here. What I'm noticing in your example snippet is that you're using a
value
prop to set the default and aonChange
prop to manage the controlled component updates. These APIs aren't supported by Combobox within Paste. In fact, if you are using typescript in your project our published type annotations will alert you of this issue at development time prior to executing the code:As for a solution, if you would prefer to allow the DOM to manage the updates (uncontrolled) you can provide a default with a
initialSelectedItem="Adrienne Maree Brown"
prop. If you would like manage the updates explicitly (controlled) you'll want to use ainitialValue="A…