linaria icon indicating copy to clipboard operation
linaria copied to clipboard

`forwardedAs` prop similar to styled-components

Open afzalsayed96 opened this issue 4 years ago • 2 comments

Describe the feature

Is it possible to provide forwardedAs prop similar to that of styled-components along with the usual as prop?

Motivation

When nesting and overriding styled components we sometimes end up overriding the custom component with the as prop.

const Text = styled.p``

const Title = styled(Text)``

<Title as="h1">Title</Title>

Possible implementations

This could be solved with the help of a forwardedAs prop

<Title forwardedAs="h1">Title</Title>

Related Issues

N.A.

afzalsayed96 avatar Dec 07 '20 08:12 afzalsayed96

Here's a repro: https://codesandbox.io/s/gifted-hamilton-loczx?file=/src/App.js

afzalsayed96 avatar Dec 26 '20 08:12 afzalsayed96

This feature is really needed

aspirisen avatar Dec 15 '22 23:12 aspirisen