How to make a select option always on filtered list?
Is there any way to make a select option always available, no matter what the filter string is? Seems like there's no ready prop to use. I only need to display one select option no matter what the input is, other options can be filtered the default way. Should I use filterOption for customised filter? I looked through the documentation but find no example how to use this either.
+1
+1
found the solution:
filterSelectOptions = options => [{ value: 'default', label: 'Default Option' }].concat(options);
<Select.Async name="form-field-name" value={this.state.option} loadOptions={this.getOptions} onChange={val => this.selectSearchChange(val)} optionComponent={selectOption} filterOptions={this.filterSelectOptions} />
Hello -
In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.
We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.
If you feel this issue / pull request 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.