Skip to content

[Select]: Icon not rendering as child of Option #4920

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

Closed
1 task done
codingfabi opened this issue Jul 26, 2023 · 5 comments · Fixed by #5022
Closed
1 task done

[Select]: Icon not rendering as child of Option #4920

codingfabi opened this issue Jul 26, 2023 · 5 comments · Fixed by #5022

Comments

@codingfabi
Copy link

Describe the bug

I want to create a custom color picker using the Select component that renders the color as a icon and the color name as a label. Even though the documentation says that the Option subcomponent of the Select component renders arbitrary ReactNodes, Icon components do not get rendered when added as children.

I saw that the Option component itself has an icon property. However, there is now option to style this icon and I need to change the icons color for each option.

Isolated Example

https://codesandbox.io/p/sandbox/festive-lederberg-zr7rwn?file=%2Fsrc%2FApp.tsx%3A41%2C10

Reproduction steps

See sandbox.

Expected Behaviour

I would expect the Option to render the Icon element as a child, next to the label. It would also work if there is a simple way to style the icon that is passed as property to the Option component.

Screenshots or Videos

No response

UI5 Web Components for React Version

1.17.0

UI5 Web Components Version

1.15.0

Browser

Chrome

Operating System

No response

Additional Context

No response

Relevant log output

No response

Declaration

  • I’m not disclosing any internal or sensitive information.
@Lukas742
Copy link
Contributor

Lukas742 commented Aug 1, 2023

Hi @codingfabi

as the description of the prop states, only text is supported:

Note: Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.

Also, the same applies for the Button. The difference to the button is, that the Option is an abstract ui5 web component and therefore it's not customizable outside of the given props. (this information was missing in the documentation of ui5-webcomponents and will be available with their next release)

If you feel like this behavior should be possible, please open a feature request in the UI5 Web Components repo, as this component is developed there.

@github-actions
Copy link

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Inactive issues will be closed after 7 days. Thanks.

@github-actions github-actions bot added the Stale label Aug 16, 2023
@Lukas742
Copy link
Contributor

Hi @codingfabi

the UI5 Web Components team, is currently working on a prototype (SAP/ui5-webcomponents#7447), allowing customization of the Select component. If the POC will be productized, then you will also be able to implement the design and behavior you're trying to achieve.

@github-actions
Copy link

github-actions bot commented Sep 4, 2023

🎉 This issue has been resolved in version v1.19.0 🎉

The release is available on v1.19.0

Your semantic-release bot 📦🚀

@Lukas742
Copy link
Contributor

Lukas742 commented Sep 4, 2023

Hi @codingfabi

you can now use the SelectMenu component to achieve the described behavior.
https://sap.github.io/ui5-webcomponents-react/?path=/docs/inputs-select--docs#selectmenu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

2 participants