ST

Styled Components

styled-components

Fast, expressive styling for React.

Component Libraries
react
css
css-in-js
styled-components
styling
Component Libraries
javascript
npm
frontend
open source
Stars
41k
Weekly
0
Open issues
27
Bundle
~60 kB

Installation

npm install styled-components

Code example

import styled from "styled-components";

const Button = styled.button`
  padding: 8px 12px;
  border-radius: 8px;
  background: black;
  color: white;
`;

export function Example() {
  return <Button>Save</Button>;
}

Pros & cons

Pros

  • Actively maintained by Glen Maddern
  • 0 weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~60 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 27 open issues on GitHub

FAQs

Alternatives & similar libraries