question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Selecting multiple options that have the same value.

See original GitHub issue

I am trying to allow the react-select component to select the same option multiple times. Currently if I select an option it is removed from the dropdown and thus cannot be selected again. How can I disable this logic and allow selecting the same option many times?

const options = [ { value: 'aapl', label: 'Apple' }, { value: 'msft', label: 'Microsoft' }, { value: 'tsla', label: 'Tesla' } ] <Select placeholder={'Select multiple stocks to chart'} isMulti={true} options={options} />

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
philipbulleycommented, Dec 7, 2018

Set the hideSelectedOptions={false} prop on the <Select>, that will prevent the option from being removed once selected. You can then handle multiple clicks of the same option. Note that the action passed to onChange will alternate between select-option and deselect-option.

🤔 Your use-case does sound a little odd though. Consider whether you’re sticking to common and familiar UX patterns, otherwise, you may end up with an unintuitive interface.

0reactions
bladeycommented, May 28, 2020

Hello -

In an effort to sustain the react-select project going forward, we’re closing old issues.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.

If you aren’t using the latest version of react-select please consider upgrading to see if it resolves any issues you’re having.

However, if you feel this issue is still relevant and you’d like us to review it - please leave a comment and we’ll do our best to get back to you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Select Multiple Items from a Drop Down List in Excel
He wanted to make multiple selections from the same drop down in such a way that the selections get added to the already...
Read more >
How to get all selected values of a multiple select box?
No jQuery: // Return an array of the selected opion values // select is an HTML select element function getSelectValues(select) { var result...
Read more >
HTML select multiple Attribute - W3Schools
For Mac: Hold down the command button to select multiple options. Because of the different ways of doing this, and because you have...
Read more >
Excel Data Validation Drop Down Select Multiple Items
Add Values To the Same Cell. With another variation in the VBA code, you can keep all the selected items in the same...
Read more >
How to have multiple Select options with same value? - Support
Like it says on the tin I would like to have multiple select options with the same value. For instance: 100 : Item...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found