styled-components
Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress πŸ’…
Last updated 6 years ago by probablyup .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install styled-components 
SYNC missed versions from official npm registry.
styled-components

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress πŸ’…

downloads: 600k/month Join the community on Spectrum gzip size module formats: umd, cjs, esm


Utilising tagged template literals (a recent addition to JavaScript) and the power of CSS, styled-components allows you to write actual CSS code to style your components. It also removes the mapping between components and styles – using components as a low-level styling construct could not be easier!

styled-components is compatible with both React (for web) and React Native – meaning it's the perfect choice even for truly universal apps! See the documentation about React Native for more information.

Supported by Front End Center. Thank you for making this possible!

Docs

See the documentation at styled-components.com/docs for more information about using styled-components!

Quicklinks to some of the most-visited pages:

Example

import React from 'react';

import styled from 'styled-components';

// Create a <Title> react component that renders an <h1> which is
// centered, palevioletred and sized at 1.5em
const Title = styled.h1`
  font-size: 1.5em;
  text-align: center;
  color: palevioletred;
`;

// Create a <Wrapper> react component that renders a <section> with
// some padding and a papayawhip background
const Wrapper = styled.section`
  padding: 4em;
  background: papayawhip;
`;

// Use them like any other React component – except they're styled!
<Wrapper>
  <Title>Hello World, this is my first styled component!</Title>
</Wrapper>

This is what you'll see in your browser:

Screenshot of the above code ran in a browser

Built with styled-components

A lot of hard work goes into community libraries, projects, and guides. A lot of them make it easier to get started or help you with your next project! There’s also a whole lot of interesting apps and sites that people have built using styled-components.

Make sure to head over to awesome-styled-components to see them all! And please contribute and add your own work to the list so others can find it.

Contributing

If you want to contribute to styled-components please see our contributing and community guidelines, they'll help you get set up locally and explain the whole process.

Please also note that all repositories under the styled-components organization follow our Code of Conduct, make sure to review and follow it.

Badge

Let everyone know you're using styled-components β†’ style: styled-components

[![style: styled-components](https://img.shields.io/badge/style-%F0%9F%92%85%20styled--components-orange.svg?colorB=daa357&colorA=db748e)](https://github.com/styled-components/styled-components)

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! πŸ™ [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

License

Licensed under the MIT License, Copyright Β© 2016-present Glen Maddern and Maximilian Stoiber.

See LICENSE for more information.

Acknowledgements

This project builds on a long line of earlier work by clever folks all around the world. We'd like to thank Charlie Somerville, Nik Graf, Sunil Pai, Michael Chan, Andrey Popp, Jed Watson & Andrey Sitnik who contributed ideas, code or inspiration.

Special thanks to @okonet for the fantastic logo.

Current Tags

  • 6.0.0-alpha.7                                ...           alpha (2 years ago)
  • 6.0.0-rc.0                                ...           beta (2 years ago)
  • 6.1.13                                ...           latest (4 months ago)
  • 6.0.0-rc.2-4007                                ...           pr-4007 (2 years ago)
  • 5.3.1-pr3563                                ...           pr3563 (3 years ago)
  • 5.3.1-pr3564                                ...           pr3564 (3 years ago)
  • 6.1.9-react-18-streaming-prototype                                ...           react-18-streaming-prototype (8 months ago)
  • 6.1.10-test.1                                ...           test (8 months ago)

358 Versions

  • 6.1.13                                ...           4 months ago
  • 6.1.12                                ...           5 months ago
  • 6.1.11                                ...           8 months ago
  • 6.1.10-test.1                                ...           8 months ago
  • 6.1.10-test.0                                ...           8 months ago
  • 6.1.10                                ...           8 months ago
  • 6.1.9                                ...           8 months ago
  • 6.1.9-react-18-streaming-prototype                                ...           8 months ago
  • 6.1.8                                ...           a year ago
  • 6.1.7                                ...           a year ago
  • 6.1.6                                ...           a year ago
  • 6.1.5                                ...           a year ago
  • 6.1.5-rc.0                                ...           a year ago
  • 6.1.4                                ...           a year ago
  • 6.1.3                                ...           a year ago
  • 6.1.2                                ...           a year ago
  • 6.1.1                                ...           a year ago
  • 6.1.0                                ...           a year ago
  • 6.0.9                                ...           a year ago
  • 6.0.8                                ...           a year ago
  • 6.0.7                                ...           a year ago
  • 6.0.6                                ...           a year ago
  • 6.0.6-test.0                                ...           a year ago
  • 6.0.5                                ...           a year ago
  • 6.0.4                                ...           a year ago
  • 6.0.3                                ...           a year ago
  • 6.0.2                                ...           a year ago
  • 6.0.1                                ...           a year ago
  • 6.0.0                                ...           a year ago
  • 6.0.0-rc.6                                ...           2 years ago
  • 6.0.0-rc.5                                ...           2 years ago
  • 6.0.0-rc.4                                ...           2 years ago
  • 6.0.0-rc.3                                ...           2 years ago
  • 6.0.0-rc.2-4007                                ...           2 years ago
  • 5.3.11                                ...           2 years ago
  • 6.0.0-rc.2                                ...           2 years ago
  • 6.0.0-rc.1                                ...           2 years ago
  • 6.0.0-rc.0                                ...           2 years ago
  • 5.3.10                                ...           2 years ago
  • 6.0.0-beta.15                                ...           2 years ago
  • 6.0.0-beta.14                                ...           2 years ago
  • 5.3.9                                ...           2 years ago
  • 6.0.0-beta.13                                ...           2 years ago
  • 5.3.8                                ...           2 years ago
  • 6.0.0-beta.12                                ...           2 years ago
  • 5.3.7                                ...           2 years ago
  • 6.0.0-beta.11                                ...           2 years ago
  • 6.0.0-beta.10                                ...           2 years ago
  • 6.0.0-beta.9                                ...           2 years ago
  • 6.0.0-beta.8                                ...           2 years ago
  • 6.0.0-beta.7                                ...           2 years ago
  • 6.0.0-beta.6                                ...           2 years ago
  • 6.0.0-beta.5                                ...           2 years ago
  • 6.0.0-beta.4                                ...           2 years ago
  • 6.0.0-beta.3                                ...           2 years ago
  • 5.3.6                                ...           2 years ago
  • 6.0.0-beta.2                                ...           2 years ago
  • 6.0.0-beta.1                                ...           2 years ago
  • 6.0.0-beta.0                                ...           2 years ago
  • 6.0.0-alpha.7                                ...           2 years ago
  • 6.0.0-alpha.6                                ...           2 years ago
  • 6.0.0-alpha.5                                ...           3 years ago
  • 5.3.5                                ...           3 years ago
  • 6.0.0-alpha.4                                ...           3 years ago
  • 6.0.0-alpha.3                                ...           3 years ago
  • 6.0.0-alpha.2                                ...           3 years ago
  • 5.3.4                                ...           3 years ago
  • 6.0.0-alpha.1                                ...           3 years ago
  • 6.0.0-alpha.0                                ...           3 years ago
  • 5.3.3                                ...           3 years ago
  • 5.3.2                                ...           3 years ago
  • 5.3.1                                ...           3 years ago
  • 5.3.1-pr3564                                ...           3 years ago
  • 5.3.1-pr3563                                ...           3 years ago
  • 5.3.0                                ...           4 years ago
  • 5.2.3                                ...           4 years ago
  • 5.2.2                                ...           4 years ago
  • 5.2.1                                ...           4 years ago
  • 5.2.0                                ...           4 years ago
  • 5.2.0-test.12                                ...           4 years ago
  • 5.2.0-test.11                                ...           4 years ago
  • 5.2.0-test.10                                ...           4 years ago
  • 5.2.0-test.9                                ...           4 years ago
  • 5.2.0-test.8                                ...           4 years ago
  • 5.2.0-test.7                                ...           4 years ago
  • 5.2.0-test.6                                ...           4 years ago
  • 5.2.0-test.5                                ...           4 years ago
  • 5.2.0-test.4                                ...           4 years ago
  • 5.2.0-test.3                                ...           4 years ago
  • 5.2.0-test.2                                ...           4 years ago
  • 5.2.0-test.1                                ...           4 years ago
  • 5.2.0-test.0                                ...           4 years ago
  • 5.1.1                                ...           5 years ago
  • 5.1.0                                ...           5 years ago
  • 5.0.1-revisedssr                                ...           5 years ago
  • 5.0.1                                ...           5 years ago
  • 5.0.0-testgrouplimit.0                                ...           5 years ago
  • 5.0.0-testdeopt2                                ...           5 years ago
  • 5.0.0-testdeopt                                ...           5 years ago
  • 5.0.0                                ...           5 years ago
  • 5.0.0-cgsmem                                ...           5 years ago
  • 5.0.0-rc.3                                ...           5 years ago
  • 5.0.0-fixhoist                                ...           5 years ago
  • 5.0.0-rc.2                                ...           5 years ago
  • 5.0.0-regexrehydrate                                ...           5 years ago
  • 5.0.0-rc.1                                ...           5 years ago
  • 4.4.1                                ...           5 years ago
  • 5.0.0-rc.0                                ...           5 years ago
  • 5.0.0-beta.11-cgsmulti                                ...           5 years ago
  • 5.0.0-beta.11                                ...           5 years ago
  • 5.0.0-beta.10-rulefix                                ...           5 years ago
  • 5.0.0-beta.10                                ...           5 years ago
  • 4.4.0-reactnativewebfix                                ...           5 years ago
  • 4.4.0                                ...           5 years ago
  • 5.0.0-beta.9                                ...           5 years ago
  • 5.0.0-beta.8-groupsizefix                                ...           5 years ago
  • 5.0.0-beta.8                                ...           5 years ago
  • 5.0.0-beta.6-ej4                                ...           5 years ago
  • 5.0.0-beta.6-ej3                                ...           5 years ago
  • 5.0.0-beta.6-ej2                                ...           5 years ago
  • 5.0.0-beta.6-ej1                                ...           5 years ago
  • 5.0.0-beta.6-ej                                ...           5 years ago
  • 5.0.0-beta.6                                ...           5 years ago
  • 5.0.0-beta.5-removefoldedcomponentids                                ...           5 years ago
  • 5.0.0-beta.5-ej2                                ...           6 years ago
  • 5.0.0-beta.5                                ...           6 years ago
  • 5.0.0-beta.4                                ...           6 years ago
  • 4.3.2                                ...           6 years ago
  • 5.0.0-beta.3                                ...           6 years ago
  • 5.0.0-beta.2                                ...           6 years ago
  • 5.0.0-beta.1                                ...           6 years ago
  • 5.0.0-beta.0                                ...           6 years ago
  • 5.0.0-alpha.2                                ...           6 years ago
  • 5.0.0-alpha.1                                ...           6 years ago
  • 5.0.0-alpha.0                                ...           6 years ago
  • 4.3.1                                ...           6 years ago
  • 4.3.1-0                                ...           6 years ago
  • 4.3.0                                ...           6 years ago
  • 4.2.1                                ...           6 years ago
  • 5.0.0-5.canary-sheet                                ...           6 years ago
  • 5.0.0-4.canary-sheet                                ...           6 years ago
  • 5.0.0-3.canary-sheet                                ...           6 years ago
  • 5.0.0-1.canary-sheet                                ...           6 years ago
  • 5.0.0-0.canary-sheet                                ...           6 years ago
  • 4.2.0                                ...           6 years ago
  • 4.1.4-alpha.6                                ...           6 years ago
  • 4.1.4-alpha.5                                ...           6 years ago
  • 4.1.4-alpha.4                                ...           6 years ago
  • 4.1.4-alpha.3                                ...           6 years ago
  • 4.1.4-alpha.2                                ...           6 years ago
  • 4.1.3                                ...           6 years ago
  • 3.5.0-0                                ...           6 years ago
  • 4.1.2                                ...           6 years ago
  • 4.1.1                                ...           6 years ago
  • 4.1.0                                ...           6 years ago
  • 4.1.0-rehydrate                                ...           6 years ago
  • 4.0.3                                ...           6 years ago
  • 4.0.3-0                                ...           6 years ago
  • 4.0.2                                ...           6 years ago
  • 4.0.1                                ...           6 years ago
  • 4.0.1-0                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 4.0.0-beta.11.3                                ...           6 years ago
  • 3.4.10                                ...           6 years ago
  • 4.0.0-beta.11.2                                ...           6 years ago
  • 4.0.0-beta.11.1-hmr2                                ...           6 years ago
  • 4.0.0-beta.11.1-hmr                                ...           6 years ago
  • 4.0.0-beta.11.1                                ...           6 years ago
  • 4.0.0-beta.11                                ...           6 years ago
  • 4.0.0-beta.9-macro2                                ...           6 years ago
  • 4.0.0-beta.9-macro                                ...           6 years ago
  • 4.0.0-beta.10-5                                ...           6 years ago
  • 4.0.0-beta.10-4                                ...           6 years ago
  • 4.0.0-beta.10-3                                ...           6 years ago
  • 4.0.0-beta.10-2                                ...           6 years ago
  • 4.0.0-beta.10-1                                ...           6 years ago
  • 4.0.0-beta.10                                ...           6 years ago
  • 4.0.0-beta.9                                ...           6 years ago
  • 4.0.0-beta.8-unpure                                ...           6 years ago
  • 4.0.0-beta.8                                ...           6 years ago
  • 4.0.0-beta.7-hoist                                ...           6 years ago
  • 3.4.9                                ...           6 years ago
  • 4.0.0-beta.7                                ...           6 years ago
  • 3.4.8                                ...           6 years ago
  • 3.4.7                                ...           6 years ago
  • 4.0.0-beta.6                                ...           6 years ago
  • 4.0.0-beta.5                                ...           6 years ago
  • 4.0.0-beta.4-hmr                                ...           6 years ago
  • 4.0.0-beta.4                                ...           6 years ago
  • 4.0.0-beta.3-purecomponent                                ...           6 years ago
  • 4.0.0-beta.3-side-effect-test                                ...           6 years ago
  • 4.0.0-beta.3                                ...           6 years ago
  • 3.4.6                                ...           6 years ago
  • 4.0.0-beta.2-0                                ...           6 years ago
  • 4.0.0-beta.2                                ...           6 years ago
  • 4.0.0-beta.1-2                                ...           6 years ago
  • 4.0.0-beta.1-1                                ...           6 years ago
  • 4.0.0-beta.1                                ...           6 years ago
  • 4.0.0-beta.0-2                                ...           6 years ago
  • 4.0.0-beta.0-1                                ...           6 years ago
  • 4.0.0-beta.0                                ...           6 years ago
  • 3.4.5                                ...           6 years ago
  • 3.4.4                                ...           6 years ago
  • 3.4.3                                ...           6 years ago
  • 3.4.2                                ...           6 years ago
  • 3.4.1                                ...           6 years ago
  • 3.4.0                                ...           6 years ago
  • 3.4.0-4                                ...           6 years ago
  • 3.4.0-0                                ...           6 years ago
  • 3.3.3                                ...           7 years ago
  • 3.3.3-3                                ...           7 years ago
  • 3.3.3-2                                ...           7 years ago
  • 3.3.3-1                                ...           7 years ago
  • 3.3.2                                ...           7 years ago
  • 3.3.1-beta.0                                ...           7 years ago
  • 2.4.1                                ...           7 years ago
  • 3.3.1                                ...           7 years ago
  • 3.3.0                                ...           7 years ago
  • 3.2.6                                ...           7 years ago
  • 3.2.5                                ...           7 years ago
  • 3.2.4                                ...           7 years ago
  • 3.2.3                                ...           7 years ago
  • 3.2.3-ssrmem1                                ...           7 years ago
  • 3.2.2                                ...           7 years ago
  • 3.2.2-1                                ...           7 years ago
  • 3.2.2-0                                ...           7 years ago
  • 3.2.1                                ...           7 years ago
  • 3.2.1-2                                ...           7 years ago
  • 3.2.1-1                                ...           7 years ago
  • 3.2.1-0                                ...           7 years ago
  • 3.2.0                                ...           7 years ago
  • 3.2.0-1                                ...           7 years ago
  • 3.2.0-0                                ...           7 years ago
  • 3.2.0-stylerefactor2                                ...           7 years ago
  • 3.2.0-stylerefactor1                                ...           7 years ago
  • 3.1.6                                ...           7 years ago
  • 3.1.6-2                                ...           7 years ago
  • 3.1.6-1                                ...           7 years ago
  • 3.1.6-0                                ...           7 years ago
  • 3.1.5                                ...           7 years ago
  • 3.1.4                                ...           7 years ago
  • 3.1.3                                ...           7 years ago
  • 3.1.2                                ...           7 years ago
  • 3.1.1                                ...           7 years ago
  • 3.1.0                                ...           7 years ago
  • 3.1.0-speedy6                                ...           7 years ago
  • 3.1.0-speedy5                                ...           7 years ago
  • 3.1.0-speedy4                                ...           7 years ago
  • 3.1.0-speedy3                                ...           7 years ago
  • 3.1.0-speedy2                                ...           7 years ago
  • 3.1.0-speedy                                ...           7 years ago
  • 3.1.0-3                                ...           7 years ago
  • 3.1.0-1                                ...           7 years ago
  • 3.1.0-0                                ...           7 years ago
  • 3.0.2                                ...           7 years ago
  • 3.0.1                                ...           7 years ago
  • 2.5.0-1                                ...           7 years ago
  • 2.4.0                                ...           7 years ago
  • 2.4.0-0                                ...           7 years ago
  • 2.3.3                                ...           7 years ago
  • 2.3.3-0                                ...           7 years ago
  • 2.3.2                                ...           7 years ago
  • 2.3.1                                ...           7 years ago
  • 2.3.0                                ...           7 years ago
  • 2.2.4                                ...           7 years ago
  • 2.2.3                                ...           7 years ago
  • 2.2.2                                ...           7 years ago
  • 2.2.1                                ...           7 years ago
  • 2.2.0                                ...           7 years ago
  • 2.1.3-0                                ...           7 years ago
  • 2.1.2                                ...           7 years ago
  • 2.1.1-1                                ...           7 years ago
  • 2.1.1                                ...           7 years ago
  • 2.1.1-0                                ...           8 years ago
  • 2.1.0                                ...           8 years ago
  • 2.0.1                                ...           8 years ago
  • 2.0.0                                ...           8 years ago
  • 2.0.0-19                                ...           8 years ago
  • 2.0.0-18                                ...           8 years ago
  • 1.4.6                                ...           8 years ago
  • 2.0.0-17                                ...           8 years ago
  • 2.0.0-16                                ...           8 years ago
  • 1.4.5                                ...           8 years ago
  • 2.0.0-15                                ...           8 years ago
  • 2.0.0-14                                ...           8 years ago
  • 2.0.0-13                                ...           8 years ago
  • 2.0.0-12                                ...           8 years ago
  • 2.0.0-11                                ...           8 years ago
  • 2.0.0-10                                ...           8 years ago
  • 2.0.0-9                                ...           8 years ago
  • 2.0.0-8                                ...           8 years ago
  • 2.0.0-7                                ...           8 years ago
  • 2.0.0-6                                ...           8 years ago
  • 1.4.4                                ...           8 years ago
  • 2.0.0-5                                ...           8 years ago
  • 2.0.0-4                                ...           8 years ago
  • 2.0.0-3                                ...           8 years ago
  • 2.0.0-2                                ...           8 years ago
  • 1.4.3                                ...           8 years ago
  • 2.0.0-1                                ...           8 years ago
  • 1.4.2                                ...           8 years ago
  • 1.4.1                                ...           8 years ago
  • 1.4.0                                ...           8 years ago
  • 2.0.0-0                                ...           8 years ago
  • 1.3.1                                ...           8 years ago
  • 1.3.0                                ...           8 years ago
  • 1.2.1                                ...           8 years ago
  • 1.2.0                                ...           8 years ago
  • 1.1.3                                ...           8 years ago
  • 1.1.2                                ...           8 years ago
  • 1.1.2-0                                ...           8 years ago
  • 1.1.1                                ...           8 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.12-0                                ...           8 years ago
  • 1.0.11                                ...           8 years ago
  • 1.0.10                                ...           8 years ago
  • 1.0.9                                ...           8 years ago
  • 1.0.8                                ...           8 years ago
  • 1.0.7                                ...           8 years ago
  • 1.0.6                                ...           8 years ago
  • 1.0.5                                ...           8 years ago
  • 1.0.4                                ...           8 years ago
  • 1.0.3                                ...           8 years ago
  • 1.0.2                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
  • 0.4.2                                ...           8 years ago
  • 0.4.1                                ...           8 years ago
  • 0.4.0                                ...           8 years ago
  • 0.3.4                                ...           8 years ago
  • 0.3.3                                ...           8 years ago
  • 0.3.2                                ...           8 years ago
  • 0.3.1                                ...           8 years ago
  • 0.3.0                                ...           8 years ago
  • 0.2.5                                ...           8 years ago
  • 0.2.4                                ...           8 years ago
  • 0.2.3                                ...           8 years ago
  • 0.2.2                                ...           8 years ago
  • 0.2.1                                ...           8 years ago
  • 0.2.0                                ...           8 years ago
  • 0.1.9                                ...           8 years ago
  • 0.1.8                                ...           8 years ago
  • 0.1.7                                ...           8 years ago
  • 0.1.6                                ...           8 years ago
  • 0.1.5                                ...           8 years ago
  • 0.1.4                                ...           8 years ago
  • 0.1.3                                ...           8 years ago
  • 0.1.2                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
  • 0.0.6                                ...           8 years ago
  • 0.0.5                                ...           8 years ago
  • 0.0.5-2                                ...           8 years ago
  • 0.0.5-1                                ...           8 years ago
  • 0.0.5-0                                ...           8 years ago
  • 0.0.4                                ...           8 years ago
  • 0.0.3                                ...           8 years ago
  • 0.0.2                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
Downloads
Total 22
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 20
Dependencies (8)

© 2010 - cnpmjs.org x YWFE | Home | YWFE