-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Dropdown component label search #2110
Conversation
let labelKey = 'label'; | ||
if (firstOption && firstOption.search) { | ||
labelKey = 'search'; | ||
} else if (firstOption && React.isValidElement(firstOption.label)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see people using strings for some options and components for others - like if they want a few options to have custom font color but others just use the default behavior. So just looking at the first one may not be robust. Also wondering if there's a way to pull the text out of a component for the same use case, particularly when the value is encoded in a way that isn't useful for searching (matching names to ID numbers or something). But it could still be nice to search on value too, especially if the search would match EITHER label or value. Is that possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it could still be nice to search on value too, especially if the search would match EITHER label or value. Is that possible?
It's possible to add field indexes to the search, maybe we should add a new prop search_indexes
, then it could match any field in a dictionary of options ?
1505f55
to
a3e393d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃
Add
search
prop for the options ofdcc.Dropdown
. Fix #2108label
is a component or provide a custom search value different from the label.value
will be used for search.