-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
[Select] pass label information in renderValue()
#29497
Comments
Thanks for the feedback but I don't think the library should provide that because there is afford to find the label related to the value. I think this work should be on the consumer side, like this: <Select
...
renderValue={value => {
const item = items.find(({ value: v }) => v === value );
return item.label
}}
/> cc @mnajdova @michaldudak for other opinions. |
@siriwatknp Thanks for the quick response. I thought this could be pretty handy and could eliminate fair amount of look-up code but I always support what you guys towards to regarding API design :) |
Agree with @siriwatknp - this is pretty simple to implement on the application side and if done in the library, it would also impact the developers who don't need it. |
Agree, I am closing since instructions on how it can be achieved has been provided. |
But in single select ,How can i implement RenderValue()? |
@nishantdotcom had you find any way around for single select ? |
renderValue()
prop provides nice way of customizing how the displayed value should be looks like inSelect
.However, some information is leaking:
e.g)
Currently there's no way around accessing
Label
text, hence users should create some mapper for displayed value.Summary 💡
rednerValue()
prop should be given 'label' data somehowExamples 🌈
Motivation 🔦
I want to utilize label information inside of
renderValue()
callbackThe text was updated successfully, but these errors were encountered: