styled-forward-as
v1.0.0 styled-components forwardAs
forwardAs
Forwarding for the as
prop in styled-components a la React.forwardRef
.
import styled from 'styled-components';
import forwardAs from 'styled-forward-as';
const Button = styled.button`
/* styles */
`;
const PrefixButton = forwardAs(({ prefix, children, ...rest }, as) => (
<Button as={as} {...rest}>{prefix}{children}</Button>
))`
/* styles */
`;
npm i styled-forward-as
Metadata
- MIT
- Whatever
- [email protected]
- released 7/2/2019