JedWatson / JedWatson/react-select

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

Open
#5,799 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue/bug-unconfirmed
Dominant language
TypeScript
Stars
28k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked CodeSandbox reproduction and inspect the react-select/creatable CreatableSelect flow with the shown getOptionLabel and getOptionValue callbacks. Confirm the blank row occurs when entering a new option, then verify that the create option displays “Create "New Option"” while custom option labels and values still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.