README.md
<a href="https://www.npmjs.com/package/styled-components"></a> <a href="https://bundlephobia.com/result?p=styled-components" title="styled-components latest minified+gzip size"></a>
</div>styled-components lets you write actual CSS in your JavaScript using tagged template literals. It removes the mapping between components and styles, making components the styling primitive.
@types package needed)npm install styled-components
pnpm add styled-components
yarn add styled-components
import styled from 'styled-components';
const Title = styled.h1`
font-size: 1.5em;
text-align: center;
color: palevioletred;
`;
const Wrapper = styled.section`
padding: 4em;
background: papayawhip;
`;
function MyUI() {
return (
<Wrapper>
<Title>Hello World, this is my first styled component!</Title>
</Wrapper>
);
}
Style objects are also supported:
const Button = styled.button({
color: 'grey',
});
See the documentation at styled-components.com/docs for full usage information.
See our contributing and community guidelines and Code of Conduct.
Check out awesome-styled-components for community libraries, projects, and examples.
This project exists thanks to all the people who contribute.
<a href="https://github.com/styled-components/styled-components/graphs/contributors"></a>
Thank you to all our backers! 🙏 [Become a backer]
<a href="https://opencollective.com/styled-components#backers" target="_blank"></a>
Support this project by becoming a sponsor. [Become a sponsor]
<a href="https://opencollective.com/styled-components#sponsors" target="_blank"></a>
Licensed under the MIT License, Copyright © 2016-present styled-components contributors.
See LICENSE for more information.
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.