An open API service indexing awesome lists of open source software.

https://github.com/zillow/styled-forward-as

Forwarding for the as prop in styled-components
https://github.com/zillow/styled-forward-as

Last synced: 9 months ago
JSON representation

Forwarding for the as prop in styled-components

Awesome Lists containing this project

README

          

# forwardAs

Forwarding for the `as` prop in styled-components a la [`React.forwardRef`](https://reactjs.org/docs/forwarding-refs.html).

```jsx
import styled from 'styled-components';
import forwardAs from 'styled-forward-as';

const Button = styled.button`
/* styles */
`;

const PrefixButton = forwardAs(({ prefix, children, ...rest }, as) => (
{prefix}{children}
))`
/* styles */
`;
```