-
Hi, Is it possible to use JSX content for select options labels (which appear in the dropdown) and the selected values (which appear as pills)? For example; I have a searchable select dropdown showing available products. But against each entry in the dropdown I also want to show the category of the product along with it, a little faded. So would it be possible to use options labels as JSX? Like:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Greetings @arxoft , Yes, you can. I'd also like to add that you can also use
Heres a codesandbox demonstrating both examples Hope this answers your question. |
Beta Was this translation helpful? Give feedback.
Greetings @arxoft ,
Yes, you can.
I'd also like to add that you can also use
formatOptionLabel
to render JSX in the output instead of passing in JSX in your options data. This provides the benefit of having more control of how it is rendered (menu option vs selected value option) as well as better separation of mapping data vs rendering logic.