Reputation: 1
I have a use case in my UI where for react-select component I want to show label in the dropdown but when we select the label, the selected option shown should be label + value. How can I implement this?
Upvotes: 0
Views: 3556
Reputation: 5432
Use the formatOptionLabel
prop to create your layout for your 'selected' option (the display in the search field), but use a custom Option
layout for the display of your 'option's (or, conversely, use the prop to create your 'option' layout and provide a custom SingleValue
or MultiValueLabel
component for the display in the search field).
The documentation tells you how to apply custom components.
Upvotes: 1