CSS-In-JS API

Use Style Component to write CSS.

Usage

import styled from '@modern-js/runtime/styled';

Function Signature

see styled-component API.

Example

import styled from '@modern-js/runtime/styled';

const Button = styled.button`
  background: palevioletred;
  border-radius: 3px;
  border: none;
  color: white;
`;

const TomatoButton = styled(Button)`
  background: tomato;
`;

function ButtonExample() {
  return (
    <>
      <Button>I'm purple.</Button>
      <br />
      <TomatoButton>I'm red.</TomatoButton>
    </>
  );
}