Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-select isMulti filtering options

I am using react-select. I do not want to remove selected items from the options list. It looks like it removes selected options from the options list automatically when you add isMulti, because when I do not have isMulti, it is not removing selected option. I have seen that I can use a prop called filterOption, but I did not understand how to make it work. Can anyone tell me how to use filterOption to show all options even if some options are selected? And if Select removes the selected options automatically, does anyone have a suggestion on how I can display all the options even if some option are selected?

  import Select from 'react-select';

  ...

  <Select
    value={this.value()}
    isDisabled={this.props.disabled}
    closeMenuOnSelect={false}
    components={Animated}
    isMulti
    isClearable
    onChange={this.props.onChange}
    onBlur={this.onBlur}
    options={this.props.options}
  />

BTW: I can see that there are an option to uncheck "Remove selected options" inside the DEMO, but I can not get to the source, it returns 404. Here is the link to the demo I am looking at, under the title "Multiselect": https://jedwatson.github.io/react-select/

like image 511
RMT Avatar asked Oct 15 '25 20:10

RMT


1 Answers

I think the option you are looking for is hideSelectedOptions, you can check the documentation here and a live example here.

like image 183
Laura Avatar answered Oct 18 '25 12:10

Laura



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!