Catalog npm
Back to packageRELEASE DETAILS

6.1.12-1

npm

@0x706b/styled-components

CSS for the <Component> Age. Style components your way with speed, strong typing, and flexibility.

csscss-in-jsreactstyled-componentsstyling
Published28 Jul 2024
Direct dependencies56
Transitive dependenciesNot calculated

README

Current package documentation

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

downloads: 600k/month Discord gzip size module formats: umd, cjs, esm Code Coverage

Upgrading from v5? See the migration guide.

Utilizing tagged template literals (a recent addition to JavaScript) and the power of CSS, styled-components allow 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!

const Button = styled.button`
  color: grey;
`;

Alternatively, you may use style objects. This allows for easy porting of CSS from inline styles, while still supporting the more advanced styled-components capabilities like component selectors and media queries.

const Button = styled.button({
  color: 'grey',
});

Equivalent to:

const Button = styled.button`
  color: grey;
`;

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

function MyUI() {
  return (
    // 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:


Looking for v5?

The main branch is for the most-current version of styled-components, currently v6. For changes targeting v5, please point your PRs at the legacy-v5 branch.


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 are 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.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 58

Native requirements
56 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@emotion/is-prop-valid
Environment
{
  "local_name": "@emotion/is-prop-valid",
  "alias": false,
  "peer_metadata": null
}
1.2.2runtime
@emotion/unitless
Environment
{
  "local_name": "@emotion/unitless",
  "alias": false,
  "peer_metadata": null
}
0.8.1runtime
@types/stylis
Environment
{
  "local_name": "@types/stylis",
  "alias": false,
  "peer_metadata": null
}
4.2.5runtime
css-to-react-native
Environment
{
  "local_name": "css-to-react-native",
  "alias": false,
  "peer_metadata": null
}
3.2.0runtime
csstype
Environment
{
  "local_name": "csstype",
  "alias": false,
  "peer_metadata": null
}
3.1.3runtime
postcss
Environment
{
  "local_name": "postcss",
  "alias": false,
  "peer_metadata": null
}
8.4.38runtime
shallowequal
Environment
{
  "local_name": "shallowequal",
  "alias": false,
  "peer_metadata": null
}
1.1.0runtime
stylis
Environment
{
  "local_name": "stylis",
  "alias": false,
  "peer_metadata": null
}
4.3.2runtime
tslib
Environment
{
  "local_name": "tslib",
  "alias": false,
  "peer_metadata": null
}
2.6.2runtime
@babel/core
Environment
{
  "local_name": "@babel/core",
  "alias": false,
  "peer_metadata": null
}
7.24.5development
@babel/helper-module-imports
Environment
{
  "local_name": "@babel/helper-module-imports",
  "alias": false,
  "peer_metadata": null
}
7.24.3development
@babel/plugin-external-helpers
Environment
{
  "local_name": "@babel/plugin-external-helpers",
  "alias": false,
  "peer_metadata": null
}
7.24.1development
@babel/plugin-proposal-class-properties
Environment
{
  "local_name": "@babel/plugin-proposal-class-properties",
  "alias": false,
  "peer_metadata": null
}
7.18.6development
@babel/plugin-proposal-object-rest-spread
Environment
{
  "local_name": "@babel/plugin-proposal-object-rest-spread",
  "alias": false,
  "peer_metadata": null
}
7.20.7development
@babel/plugin-transform-flow-strip-types
Environment
{
  "local_name": "@babel/plugin-transform-flow-strip-types",
  "alias": false,
  "peer_metadata": null
}
7.24.1development
@babel/preset-env
Environment
{
  "local_name": "@babel/preset-env",
  "alias": false,
  "peer_metadata": null
}
7.24.5development
@babel/preset-react
Environment
{
  "local_name": "@babel/preset-react",
  "alias": false,
  "peer_metadata": null
}
7.24.1development
@babel/preset-typescript
Environment
{
  "local_name": "@babel/preset-typescript",
  "alias": false,
  "peer_metadata": null
}
7.24.1development
@rollup/plugin-typescript
Environment
{
  "local_name": "@rollup/plugin-typescript",
  "alias": false,
  "peer_metadata": null
}
11.1.6development
@types/enzyme
Environment
{
  "local_name": "@types/enzyme",
  "alias": false,
  "peer_metadata": null
}
3.10.18development
@types/jest
Environment
{
  "local_name": "@types/jest",
  "alias": false,
  "peer_metadata": null
}
29.5.12development
@types/js-beautify
Environment
{
  "local_name": "@types/js-beautify",
  "alias": false,
  "peer_metadata": null
}
1.14.3development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
18.19.31development
@types/react
Environment
{
  "local_name": "@types/react",
  "alias": false,
  "peer_metadata": null
}
17.0.80development
@types/react-dom
Environment
{
  "local_name": "@types/react-dom",
  "alias": false,
  "peer_metadata": null
}
17.0.25development
@types/react-frame-component
Environment
{
  "local_name": "@types/react-frame-component",
  "alias": false,
  "peer_metadata": null
}
4.1.6development
@types/react-native
Environment
{
  "local_name": "@types/react-native",
  "alias": false,
  "peer_metadata": null
}
0.69.26development
@types/react-test-renderer
Environment
{
  "local_name": "@types/react-test-renderer",
  "alias": false,
  "peer_metadata": null
}
17.0.9development
@types/shallowequal
Environment
{
  "local_name": "@types/shallowequal",
  "alias": false,
  "peer_metadata": null
}
1.1.5development
babel-jest
Environment
{
  "local_name": "babel-jest",
  "alias": false,
  "peer_metadata": null
}
29.7.0development
babel-plugin-add-module-exports
Environment
{
  "local_name": "babel-plugin-add-module-exports",
  "alias": false,
  "peer_metadata": null
}
1.0.4development
babel-plugin-styled-components
Environment
{
  "local_name": "babel-plugin-styled-components",
  "alias": false,
  "peer_metadata": null
}
2.1.4development
babel-plugin-tester
Environment
{
  "local_name": "babel-plugin-tester",
  "alias": false,
  "peer_metadata": null
}
10.1.0development
bundlewatch
Environment
{
  "local_name": "bundlewatch",
  "alias": false,
  "peer_metadata": null
}
0.3.3development
jest
Environment
{
  "local_name": "jest",
  "alias": false,
  "peer_metadata": null
}
29.7.0development
jest-environment-jsdom
Environment
{
  "local_name": "jest-environment-jsdom",
  "alias": false,
  "peer_metadata": null
}
29.7.0development
jest-serializer-html
Environment
{
  "local_name": "jest-serializer-html",
  "alias": false,
  "peer_metadata": null
}
7.1.0development
jest-watch-typeahead
Environment
{
  "local_name": "jest-watch-typeahead",
  "alias": false,
  "peer_metadata": null
}
2.2.2development
js-beautify
Environment
{
  "local_name": "js-beautify",
  "alias": false,
  "peer_metadata": null
}
1.15.1development
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
3.2.5development
prop-types
Environment
{
  "local_name": "prop-types",
  "alias": false,
  "peer_metadata": null
}
15.8.1development
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
17.0.2development
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
17.0.2development
react-frame-component
Environment
{
  "local_name": "react-frame-component",
  "alias": false,
  "peer_metadata": null
}
4.1.3development
react-native
Environment
{
  "local_name": "react-native",
  "alias": false,
  "peer_metadata": null
}
0.70.15development
react-test-renderer
Environment
{
  "local_name": "react-test-renderer",
  "alias": false,
  "peer_metadata": null
}
17.0.2development
rollup
Environment
{
  "local_name": "rollup",
  "alias": false,
  "peer_metadata": null
}
3.29.4development
rollup-plugin-commonjs
Environment
{
  "local_name": "rollup-plugin-commonjs",
  "alias": false,
  "peer_metadata": null
}
10.1.0development
rollup-plugin-json
Environment
{
  "local_name": "rollup-plugin-json",
  "alias": false,
  "peer_metadata": null
}
4.0.0development
rollup-plugin-node-resolve
Environment
{
  "local_name": "rollup-plugin-node-resolve",
  "alias": false,
  "peer_metadata": null
}
5.2.0development
rollup-plugin-replace
Environment
{
  "local_name": "rollup-plugin-replace",
  "alias": false,
  "peer_metadata": null
}
2.2.0development
rollup-plugin-sourcemaps
Environment
{
  "local_name": "rollup-plugin-sourcemaps",
  "alias": false,
  "peer_metadata": null
}
0.6.3development
rollup-plugin-terser
Environment
{
  "local_name": "rollup-plugin-terser",
  "alias": false,
  "peer_metadata": null
}
7.0.2development
stylis-plugin-rtl
Environment
{
  "local_name": "stylis-plugin-rtl",
  "alias": false,
  "peer_metadata": null
}
2.1.1development
ts-toolbelt
Environment
{
  "local_name": "ts-toolbelt",
  "alias": false,
  "peer_metadata": null
}
9.6.0development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
5.4.5development
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
>= 16.8.0peer
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
>= 16.8.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-aVgM1rjN0c/lrAog20YddCQ6AbpW0UIjhhIgeeV6lCJpIqLKbSoqCUgAqG4C131pZqXOuLkWhj6RygINix8Zag==",
  "shasum": "a446ac95853bf1fb46ce099c479de8c642ed7491",
  "tarball": "https://registry.npmjs.org/@0x706b/styled-components/-/styled-components-6.1.12-1.tgz",
  "fileCount": 150,
  "unpackedSize": 1827578,
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEQCIFPxWlZycwFeoBK6aNqVhWEskqW6ZemxzvEUg//tb8/aAiBGO8R4dmwJ6BH3laSBOIkV8pmIIlO3Tq3HT3QpUIa4fA=="
    }
  ]
}

Repository

PENDING
0x706b/styled-components

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:39 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:23617e154befc1fe4e1efa5fb479bc3ab9fe735a53e6f14a43bb867d266a1815

Other collected versions

6.1.1328 JulView all collected versions →