react-select icon indicating copy to clipboard operation
react-select copied to clipboard

React select `Create "New Option"` does not show up when using `getOptionLabel` and `getOptionValue`

Open arunbs12 opened this issue 2 years ago • 1 comments

Hello React Select Team,

I'm using react-select/creatable to create new options, when user enters new key options. Also i have getOptionLabel and getOptionValue to show and accept different value other than label and value coming from colourOptions array

<CreatableSelect classNamePrefix="select" onCreateOption={(val) => handleCreate(val)} name="color" getOptionLabel={(option) => option._id || ""} getOptionValue={(option) => option._id || ""} options={colourOptions} />

The problem is, i'm unable to see Create "New Option" as an option to create the dropdown value, Instead i'm seeing a blank row without the text.

Untitled

I have created a working flow for this issue ( Code Sandbox Link ).

Please let me know what fixes do we have for this issue. Thanks

arunbs12 avatar Nov 06 '23 11:11 arunbs12

You can add a condition in getOptionLabel image

zulmarij avatar Dec 05 '23 10:12 zulmarij