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
- Host: GitHub
- URL: https://github.com/zillow/styled-forward-as
- Owner: zillow
- Created: 2019-07-02T21:42:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T03:26:03.000Z (over 3 years ago)
- Last Synced: 2025-09-03T04:38:31.010Z (10 months ago)
- Language: JavaScript
- Size: 2.95 MB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
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 */
`;
```