styled-components logo

styled-components

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

What is styled-components?

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
styled-components is a tool in the JavaScript Framework Components category of a tech stack.
styled-components is an open source tool with 27.1K GitHub stars and 1.6K GitHub forks. Here’s a link to styled-components's open source repository on GitHub

Who uses styled-components?

Companies
139 companies reportedly use styled-components in their tech stacks, including Swat.io, Teleport, and SoFi.

Developers
178 developers on StackShare have stated that they use styled-components.

styled-components Integrations

Why developers like styled-components?

Here’s a list of reasons why companies and developers use styled-components
Top Reasons
styled-components Reviews

Here are some stack decisions, common use cases and reviews by companies and developers who chose styled-components in their tech stack.

Johnny Bell
Johnny Bell
Senior Software Engineer at StackShare · | 41 upvotes · 222.4K views
Firebase
Firebase
React
React
Redux
Redux
styled-components
styled-components
Netlify
Netlify
Gatsby
Gatsby
GitHub
GitHub
#ReactRally
#Frontend
#Google

I was building a personal project that I needed to store items in a real time database. I am more comfortable with my Frontend skills than my backend so I didn't want to spend time building out anything in Ruby or Go.

I stumbled on Firebase by #Google, and it was really all I needed. It had realtime data, an area for storing file uploads and best of all for the amount of data I needed it was free!

I built out my application using tools I was familiar with, React for the framework, Redux.js to manage my state across components, and styled-components for the styling.

Now as this was a project I was just working on in my free time for fun I didn't really want to pay for hosting. I did some research and I found Netlify. I had actually seen them at #ReactRally the year before and deployed a Gatsby site to Netlify already.

Netlify was very easy to setup and link to my GitHub account you select a repo and pretty much with very little configuration you have a live site that will deploy every time you push to master.

With the selection of these tools I was able to build out my application, connect it to a realtime database, and deploy to a live environment all with $0 spent.

If you're looking to build out a small app I suggest giving these tools a go as you can get your idea out into the real world for absolutely no cost.

See more
Vishal Narkhede
Vishal Narkhede
Javascript Developer at getStream.io · | 19 upvotes · 108.9K views
atStreamStream
Stream
Stream
React Native
React Native
Chat by Stream
Chat by Stream
JavaScript
JavaScript
Expo
Expo
styled-components
styled-components
Babel
Babel

Recently, the team at Stream published a React Native SDK for our new Chat by Stream product. React Native brings the power of JavaScript to the world of mobile development, making it easy to develop apps for multiple platforms. We decided to publish two different endpoints for the SDK – Expo and React Native (non-expo), to avoid the hurdle and setup of using the Expo library in React Native only projects on the consumer side.

The capability of style customization is one a large deal breaker for frontend SDKs. To solve this, we decided to use styled-components in our SDK, which makes it easy to add support for themes on top of our existing components. This practice reduces the maintenance effort for stylings of custom components and keeps the overall codebase clean.

For module bundling, we decided to go with Rollup.js instead of Webpack due to its simplicity and performance in the area of library/module providers. We are using Babel for transpiling code, enabling our team to use JavaScript's next-generation features. Additionally, we are using the React Styleguidist component documentation, which makes documenting the React Native code a breeze.

See more
Johnny Bell
Johnny Bell
Senior Software Engineer at StackShare · | 13 upvotes · 258.5K views
atStackShareStackShare
Markdown
Markdown
React
React
GraphQL
GraphQL
Ruby
Ruby
Showdown
Showdown
Glamorous
Glamorous
Emotion
Emotion
styled-components
styled-components
#Frontend
#CssInJs
#StackDecisionsLaunch

For Stack Decisions I needed to add Markdown in the decision composer to give our users access to some general styling when writing their decisions. We used React & GraphQL on the #Frontend and Ruby & GraphQL on the backend.

Instead of using Showdown or another tool, We decided to parse the Markdown on the backend so we had more control over what we wanted to render in Markdown because we didn't want to enable all Markdown options, we also wanted to limit any malicious code or images to be embedded into the decisions and Markdown was a fairly large to import into our component so it was going to add a lot of kilobytes that we didn't need.

We also needed to style how the markdown looked, we are currently using Glamorous so I used that but we are planning to update this to Emotion at some stage as it has a fairly easy upgrade path rather than switching over to styled-components or one of the other cssInJs alternatives.

Also we used React-Mentions for tagging tools and topics in the decisions. Typing @ will let you tag a tool, and typing # will allow you to tag a topic.

The Markdown options that we chose to support are tags: a, code, u, b, em, pre, ul, ol, li.

If there are anymore tags you'd love to see added in the composer leave me a comment below and we will look into adding them.

#StackDecisionsLaunch

See more
Divine Bawa
Divine Bawa
at PayHub Ghana Limited · | 13 upvotes · 122K views
Node.js
Node.js
GraphQL
GraphQL
MySQL
MySQL
Prisma
Prisma
graphql-yoga
graphql-yoga
React
React
styled-components
styled-components
Next.js
Next.js
Apollo
Apollo

I just finished a web app meant for a business that offers training programs for certain professional courses. I chose this stack to test out my skills in graphql and react. I used Node.js , GraphQL , MySQL for the #Backend utilizing Prisma as a database interface for MySQL to provide CRUD APIs and graphql-yoga as a server. For the #frontend I chose React, styled-components for styling, Next.js for routing and SSR and Apollo for data management. I really liked the outcome and I will definitely use this stack in future projects.

See more
Munkhtegsh Munkhbat
Munkhtegsh Munkhbat
Software Engineer Consultant at LoanSnap · | 9 upvotes · 26.1K views
graphql-yoga
graphql-yoga
Prisma
Prisma
PostgreSQL
PostgreSQL
styled-components
styled-components
Heroku
Heroku
React
React
Apollo
Apollo
GraphQL
GraphQL
#Backend
#Frontend

In my last side project, I built a web posting application that has similar features as Facebook and hosted on Heroku. The user can register an account, create posts, upload images and share with others. I took an advantage of graphql-subscriptions to handle realtime notifications in the comments section. Currently, I'm at the last stage of styling and building layouts.

For the #Backend I used graphql-yoga, Prisma, GraphQL with PostgreSQL database. For the #FrontEnd: React, styled-components with Apollo. The app is hosted on Heroku.

See more
Lee Benson
Lee Benson
React
React
GraphQL
GraphQL
Apollo
Apollo
JavaScript
JavaScript
TypeScript
TypeScript
Webpack
Webpack
React Helmet
React Helmet
styled-components
styled-components
Sass
Sass
Less
Less
PostCSS
PostCSS
Bootstrap
Bootstrap
Semantic UI
Semantic UI
Foundation
Foundation
React Router
React Router
Koa
Koa
#JSX
#React.
#Css
#StyledComponents.
#Async
#HTML
#GraphQL
#Apollo

ReactQL is a React + GraphQL front-end starter kit. #JSX is a natural way to think about building UI, and it renders to pure #HTML in the browser and on the server, making it trivial to build server-rendered Single Page Apps. GraphQL via Apollo was chosen for the data layer; #GraphQL makes it simple to request just the data your app needs, and #Apollo takes care of communicating with your API (written in any language; doesn't have to be JavaScript!), caching, and rendering to #React.

ReactQL is written in TypeScript to provide full types/Intellisense, and pick up hard-to-diagnose goofs that might later show up at runtime. React makes heavy use of Webpack 4 to handle transforming your code to an optimised client-side bundle, and in throws back just enough code needed for the initial render, while seamlessly handling import statements asynchronously as needed, making the payload your user downloads ultimately much smaller than trying to do it by hand.

React Helmet was chosen to handle <head> content, because it works universally, making it easy to throw back the correct <title> and other tags on the initial render, as well as inject new tags for subsequent client-side views.

styled-components, Sass, Less and PostCSS were added to give developers a choice of whether to build styles purely in React / JavaScript, or whether to defer to a #css #preprocessor. This is especially useful for interop with UI frameworks like Bootstrap, Semantic UI, Foundation, etc - ReactQL lets you mix and match #css and renders to both a static .css file during bundling as well as generates per-page <style> tags when using #StyledComponents.

React Router handles routing, because it works both on the server and in the client. ReactQL customises it further by capturing non-200 responses on the server, redirecting or throwing back custom 404 pages as needed.

Koa is the web server that handles all incoming HTTP requests, because it's fast (TTFB < 5ms, even after fully rendering React), and its natively #async, making it easy to async/await inside routes and middleware.

See more

styled-components Alternatives & Comparisons

What are some alternatives to styled-components?
Emotion
Emotion is a performant and flexible CSS-in-JS library. Building on many other CSS-in-JS libraries, it allows you to style apps quickly with string or object styles. It has predictable composition to avoid specificity issues with CSS. With source maps and labels, Emotion has a great developer experience and great performance with heavy caching in production.
CSS Modules
It is a CSS file in which all class names and animation names are scoped locally by default. The key words here are scoped locally. With this, your CSS class names become similar to local variables in JavaScript. It goes into the compiler, and CSS comes out the other side.
CSS Blocks
By combining an opinionated authoring system, build-time analysis and rewriting of templates, and a new type of CSS optimizer, css-blocks breathes new power and ease of use into the technologies and best practices that stylesheet developers already know and love.
React Router
React Router is a complete routing solution designed specifically for React.js. It painlessly synchronizes the components of your application with the URL, with first-class support for nesting, transitions, and server side rendering.
Ant Design
An enterprise-class UI design language and React-based implementation. Graceful UI components out of the box, base on React Component. A npm + webpack + babel + dora + dva development framework.
See all alternatives

styled-components's Followers
153 developers follow styled-components to keep up with related blogs and decisions.
shannon wendelken
Sebastian Langer
jinjin220
Keisuke Kan
Geun ho Jang
Jónatan Einarsson
Nurullah Özdemir
Raffael Campos
Douglas Waltman
Giovane de Loredo