mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.79k stars 1.9k forks source link

React component not working as Select label #1830

Closed mlarcher closed 2 years ago

mlarcher commented 2 years ago

What package has an issue

@mantine/core

Describe the bug

When using a react node as a label in mantine's Select, dropdown is fine but the value ends up being [object Object] once we make a selection. Things go fine with Multiselect for the same use case.

In which browser did the problem occur

chrome

If possible, please include a link to a codesandbox with the reproduced problem

https://codesandbox.io/s/green-voice-z72yu6

Do you know how to fix the issue

No response

Are you willing to participate in fixing this issue and create a pull request with the fix

No response

Possible fix

No response

rtivital commented 2 years ago

It is expected – Select component does not support custom labels. I'm also not planning to support them in the near future.

mlarcher commented 2 years ago

I would have thought it to be the case for NativeSelect, but not for Select. Anyhow, thanks for the quick reply. I'll find another way.

mlarcher commented 2 years ago

I was trying to build a Rating widget through it, is there any more appropriate component to use for such case ?

rtivital commented 2 years ago

No, currently we do not provide rating component

mlarcher commented 2 years ago

Ok. One last thing : isn't there something fishy in the doc about it ? It states that label property is of type ReactNode. It seems to me this should be String, considering the current behaviour... or am I missing something ?

rtivital commented 2 years ago

label prop controls <label /> element, you can render any react node there

mlarcher commented 2 years ago

gotcha. Thank you for the explanation.

ldbmcs commented 1 year ago

have the same problem