Get Advice Icon

Need advice about which tool to choose?Ask the StackShare community!

CSS Blocks
CSS Blocks

22
21
+ 1
0
styled-components
styled-components

329
149
+ 1
1
Add tool

CSS Blocks vs styled-components: What are the differences?

Developers describe CSS Blocks as "A component-oriented CSS authoring system by LinkedIn". 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. On the other hand, styled-components is detailed as "Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress". Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅.

CSS Blocks and styled-components belong to "JavaScript Framework Components" category of the tech stack.

CSS Blocks and styled-components are both open source tools. It seems that styled-components with 24.7K GitHub stars and 1.46K forks on GitHub has more adoption than CSS Blocks with 6.07K GitHub stars and 141 GitHub forks.

What is 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.

What is styled-components?

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

Need advice about which tool to choose?Ask the StackShare community!

Why do developers choose CSS Blocks?
Why do developers choose styled-components?
    Be the first to leave a pro
      Be the first to leave a con
        Be the first to leave a con
        What companies use CSS Blocks?
        What companies use styled-components?

        Sign up to get full access to all the companiesMake informed product decisions

        What tools integrate with CSS Blocks?
        What tools integrate with styled-components?

        Sign up to get full access to all the tool integrationsMake informed product decisions

        What are some alternatives to CSS Blocks and styled-components?
        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.
        Angular CLI
        A command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications. You can use the tool directly in a command shell, or indirectly through an interactive UI such as Angular Console.
        AngularUI
        UI-Modules Standalone AngularUI modules.
        Vue CLI
        Vue CLI aims to be the standard tooling baseline for the Vue ecosystem. It ensures the various build tools work smoothly together with sensible defaults so you can focus on writing your app instead of spending days wrangling with config.
        See all alternatives
        Decisions about CSS Blocks and styled-components
        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
        Johnny Bell
        Johnny Bell
        Senior Software Engineer at StackShare · | 13 upvotes · 249.8K 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
        Interest over time
        Reviews of CSS Blocks and styled-components
        No reviews found
        How developers use CSS Blocks and styled-components
        Avatar of Volkan Özçelik
        Volkan Özçelik uses styled-componentsstyled-components

        For styling components, styled-components work great (really!)

        You don’t have to use it for everything. You can still use good old CSS classes along with your styled components.

        What I do generally is to separate the “layout”, “typography”, “vertical rhythm”, and “reset” to good old CSS, and style the rest of the app with styled components.

        How much does CSS Blocks cost?
        How much does styled-components cost?
        Pricing unavailable
        Pricing unavailable
        News about CSS Blocks
        More news
        News about styled-components
        More news