styled-forward-as

1.0.0 • Public • Published

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 */
`;

Package Sidebar

Install

npm i styled-forward-as

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

24.6 kB

Total Files

40

Last publish

Collaborators

  • zg-rao
  • ryangoo
  • koellery
  • stonebk