-
Hi |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
(Converted from issues to discussion) The prop you are likely looking for is const formatOptionLabel = (option, { context }) => {
return context === 'menu' ?
(<div>
<div>{option.id}</div>
<div>{option.description}</div>
<div>{option.product}</div>
<div>
) : option.label
}
return <Select formatOptionLabel={formatOptionLabel} {...otherProps} /> To search on any of the fields, you can modify the More information on custom filtering can be found here: https://react-select.com/advanced#custom-filter-logic import Select, { createFilter } from 'react-select';
const filterConfig = {
stringify: ({ data }) => `${data.id} ${data.description} ${data.product}`
};
return <Select filterOptions={createFilter(filterConfig)} {...otherProps} /> |
Beta Was this translation helpful? Give feedback.
(Converted from issues to discussion)
The prop you are likely looking for is
formatOptionLabel
to render JSX for your option.To search on any of the fields, you can modify the
filterOptions
. There are a few custom options you can use to modify how the filtering is done. In this case, you would want to usecreateFilter
and pass in astringify
function which takes all of the data you want to sea…