How to make onSelectResetsInput example works with non-multi react select? #4384
-
Hello everyone, current behavior:
Desired Behavior:
Thanks in Advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Greetings @MohammedSaberMohammed , In the following Discussion thread #4341 highlighting previous codesandbox examples developed for the community, you will find an example which allows a user to retain the inputValue. https://codesandbox.io/s/react-select-editable-and-selectable-6nfdv Please note the behavior is designed to clear out input when the input is blurred. // onBlur => setInputValue to last selected value
if (action === "input-blur") {
setInputValue(value ? value.label : "");
} If you would like to retain whatever text was entered, you can replace the empty string assignment with I hope this is helpful and let me know if you have questions about the implementation or modifications. |
Beta Was this translation helpful? Give feedback.
Greetings @MohammedSaberMohammed ,
In the following Discussion thread #4341 highlighting previous codesandbox examples developed for the community, you will find an example which allows a user to retain the inputValue.
https://codesandbox.io/s/react-select-editable-and-selectable-6nfdv
Please note the behavior is designed to clear out input when the input is blurred.
If you would like to retain whatever text was entered, you can replace the empty string assignment with
inputValue
I hope this is helpful and let me know if you have questions about the…