Skip to content
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

Add withComponent Interface or as Prop Similar to EmotionJS #147

Closed
wh5938316 opened this issue Jun 19, 2024 · 1 comment
Closed

Add withComponent Interface or as Prop Similar to EmotionJS #147

wh5938316 opened this issue Jun 19, 2024 · 1 comment
Assignees
Labels
package: system Specific to @mui/system

Comments

@wh5938316
Copy link

wh5938316 commented Jun 19, 2024

Summary

I am wondering if there are any plans to add a withComponent interface or an as prop similar to EmotionJS. This feature would be incredibly useful for scenarios where we need to specify the HTML tag used for rendering a component.

Examples

https://emotion.sh/docs/styled#change-the-rendered-tag-using-withcomponent
https://styled-components.com/docs/api#as-polymorphic-prop

Motivation

const Component = styled.div`
  color: red;
`;

render(
  <Component
    as="button"
    onClick={() => alert('It works!')}
  >
    Hello World!
  </Component>
)

Search keywords: withComponent, as Prop, EmotionJS

@wh5938316 wh5938316 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 19, 2024
@zannager zannager added the package: system Specific to @mui/system label Jun 19, 2024
@brijeshb42
Copy link
Contributor

This already works right now.

@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: system Specific to @mui/system
Projects
None yet
Development

No branches or pull requests

3 participants