linaria icon indicating copy to clipboard operation
linaria copied to clipboard

Styling any component

Open pure-engineering opened this issue 5 years ago • 1 comments

Describe the enhancement

It would be great to be able to style any component, as implemented in styled-components https://styled-components.com/docs/basics#styling-any-component

Motivation

Possible implementations

import { styled } from '@linaria/react';

const Link = ({ className, children }) => (
  <a className={className}>
    {children}
  </a>
);

const StyledLink = styled(Link)`
  color: palevioletred;
  font-weight: bold;
`;

render(
  <div>
    <Link>Unstyled, boring Link</Link>
    <br />
    <StyledLink>Styled, exciting Link</StyledLink>
  </div>
);

Related Issues

pure-engineering avatar Aug 03 '21 11:08 pure-engineering

You can use styled for styling any component that accepts className (and style if you want to use props-based interpolation).

Anber avatar Aug 08 '21 12:08 Anber