Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Allow adding some related keywords to dropdown items so that they can be searched based on those keywords #299

Closed
2 of 6 tasks
thebishalniroula opened this issue Oct 29, 2023 · 1 comment
Assignees
Labels
Feature Request A new feature requested for the package

Comments

@thebishalniroula
Copy link

Description

[Feature request] Allow adding some related keywords to dropdown items so that they can be searched based on those keywords

chakra-react-select Version

latest

Link to Reproduction

No response

TypeScript?

  • Yes I use TypeScript

Steps to reproduce

  1. Go to '...'
  2. Click on '...'
  3. Scroll down to '...'
  4. See error

Operating System

  • macOS
  • Windows
  • Linux
  • iOS/iPadOS
  • Android

Additional Information

No response

@thebishalniroula thebishalniroula added the Bug Something isn't working label Oct 29, 2023
@csandman csandman added Feature Request A new feature requested for the package and removed Bug Something isn't working labels Oct 30, 2023
@csandman
Copy link
Owner

csandman commented Nov 7, 2023

This package has nothing to do with the filtering logic used by react-select, so this isn't something that will be added to this package. However, custom filtering logic is already something supported by the core package:

Custom Filter logic

While React-Select assumes a standard way of filtering the menu on search, our api allows you to customise that filtering logic in various ways.

createFilter function

React-Select exports a createFilter function that returns a filterOption method. By using this, users can pick and choose bits of the filtration logic to customize, without having to rewrite the logic wholesale.

// default filter configuration
ignoreCase: true,
ignoreAccents: true,
matchFrom: 'any',
stringify: option => `${option.label} ${option.value}`,
trim: true,

...

filterOption

If you really would like to rewrite the filtration logic from the ground up, simply declare a new filterOption function to be passed in as a prop to react-select. For details on the shape of the filterOption prop, please see the proptypes in the api docs here.

https://react-select.com/advanced#custom-filter-logic

@csandman csandman closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request A new feature requested for the package
Projects
None yet
Development

No branches or pull requests

2 participants