Implement custom search with custom label using react-select

Today, we will show you how to implement custom search with custom label using react-select. In the past article, we have added an icon in the react-select dropdown. But when you search for the label then you can’t search the item. So we have to implement the custom search using different key.

Demo Application

Output - Implement custom search with custom label using react-select - Clue Mediator
Output – Implement custom search with custom label using react-select – Clue Mediator

Custom search with custom label using react-select

  1. Add custom label in react-select dropdown
  2. Implement custom search
  3. Output

1. Add custom label in react-select dropdown

Refer to the following article to implement react-select dropdown in React Application.

How to add an icon in the react-select dropdown

2. Implement custom search

To implement custom search, we have to use filterOption property of the react-select package where you can write your custom logic to filter the dropdown items.

3. Output

Let’s combine all the code together and see how it looks.

App.js

Run the project and check the output in the browser.

I hope you find this article helpful.
Thank you for reading. Happy Coding..!! 🙂

Demo & Source Code

GitHub Repository StackBlitz Project
If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *