[select] If "items" is a list of objects and the "label" is not named "label" selected value should show the display value #2796
Answered
by
segunadebayo
JordanDDisch
asked this question in
Q&A
-
if we pass the select items prop an array of objects like: [
{
"name": "Africa",
"value": "AF"
},
{
"name": "Americas",
"value": "AM"
}
] The selected item shows the value as the display value i.e. "AM" instead of "Americas". But if I change the "name" key to "label" it works. Is this configurable? Example: https://stackblitz.com/edit/github-ku6ba6-zja3vz?file=src%2Froutes%2Findex.tsx |
Beta Was this translation helpful? Give feedback.
Answered by
segunadebayo
Aug 23, 2024
Replies: 1 comment
-
Yes, it's configurable. Pass <Select.Root items={regions} name="fw" itemToString={(item) => item.name}> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
segunadebayo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, it's configurable. Pass
itemToString
prop to the select component