css-in-js VS JSS

Compare css-in-js vs JSS and see what are their differences.

css-in-js

React: CSS in JS techniques comparison (by MicheleBertoli)

JSS

JSS is an authoring tool for CSS which uses JavaScript as a host language. (by cssinjs)
Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
css-in-js JSS
3 16
5,532 7,050
- 0.1%
0.0 0.0
about 3 years ago 9 months ago
JavaScript JavaScript
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

css-in-js

Posts with mentions or reviews of css-in-js. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-11-23.
  • Front-end Guide
    54 projects | dev.to | 23 Nov 2022
    As you might have realized by now, the front end ecosystem is saturated with tools, and unsurprisingly, tools have been invented to partially solve some of the problems with writing CSS at scale. "At scale" means that many developers are working on the same large project and touching the same stylesheets. There is no community-agreed approach on writing CSS in JS at the moment, and we are hoping that one day a winner would emerge, just like Redux did, among all the Flux implementations. For now, we are banking on CSS Modules. CSS modules is an improvement over existing CSS that aims to fix the problem of global namespace in CSS; it enables you to write styles that are local by default and encapsulated to your component. This feature is achieved via tooling. With CSS modules, large teams can write modular and reusable CSS without fear of conflict or overriding other parts of the app. However, at the end of the day, CSS modules are still being compiled into normal globally-namespaced CSS that browsers recognize, and it is still important to learn and understand how raw CSS works.
  • Why are "CSS classes generally better for performance than inline styles." ~ from react docs
    3 projects | /r/reactjs | 12 Apr 2022
    There are a myriad of CSS-in-JS tools, many of which are zero-runtime giving you all the benefits of authoring in a single file without the drawbacks of inline styles. That's how I prefer to do my CSS with React anyway... Vanilla Extract and/or Linaria are my current favorites.
  • Why was CSS-In-JS ever a thing?
    6 projects | /r/reactjs | 12 Feb 2022
    One thing I think you're really missing is what the output is of CSS-in-JS. There are tens of CSS-in-JS frameworks that can output anything from: CSS Module like classes (Linaria, Vanilla Extract), Atomic Classes (StyleX, PreStyle), to the more traditional (Styled Components, Emotion) many with zero runtime cost (ie no JS bloat). That's why I say CSS-in-JS is primarily about developer experience... the output can often be whatever you want it to be.

JSS

Posts with mentions or reviews of JSS. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-12-28.
  • CSS in Perl
    2 projects | dev.to | 28 Dec 2023
    Most websites those days are SPA applications that render on the front-side. There is also this trend of CSS in JavaScript also knowns as JSS that is debatable (makes everything overcomplicated), but in some specific cases, can be justified and very useful.
  • CSS Solves Auto-Expanding Textareas
    2 projects | news.ycombinator.com | 30 Sep 2023
    > why tf aren't we using JS for styling already

    People are and have been for quite a while

    https://cssinjs.org/

  • Front-end Guide
    54 projects | dev.to | 23 Nov 2022
    JSS
  • programmatic design with JS?
    1 project | /r/reactjs | 19 Nov 2022
  • Is it possible to style a website in JS only and if it is, is it recommended? Are there some downsides?
    2 projects | /r/learnjavascript | 7 Apr 2022
    It is possible. At its most simple, you could just modify the style property on every element. That's not generally considered best practice, but there are a number of "CSS-in-JS" libraries which streamline the process. The typically generate dynamic CSS classes and apply them to your elements. A big one is JSS.
  • Ukraine calls on gaming industry to suspend business with Russia
    2 projects | /r/worldnews | 2 Mar 2022
  • Amplify, React and Typescript
    1 project | dev.to | 20 Feb 2022
    import React, { useState, useEffect } from "react"; import Amplify, { API, graphqlOperation } from "aws-amplify"; import { createBlog } from "./graphql/mutations"; import { listBlogs } from "./graphql/queries"; import awsExports from "./aws-exports"; import { ListBlogsQuery } from "./API"; Amplify.configure(awsExports); const initialState = { name: "", body: "" }; const App = () => { const [formState, setFormState] = useState(initialState); const [blogs, setBlogs] = useState(); useEffect(() => { fetchBlogs() }, []); const handleInputChange = (event: React.ChangeEvent) => { setFormState({ ...formState, [event.target.name]: event.target.value }); }; const fetchBlogs = async () => { try { const blogData = (await API.graphql(graphqlOperation(listBlogs))) as { data: ListBlogsQuery } setBlogs(blogData.data); } catch (err) { console.log("Error fetching blogs" + err); } }; const addBlog = async () => { try { if (!formState.name || !formState.body) return; const blog = { ...formState }; if (blogs) { await API.graphql(graphqlOperation(createBlog, { input: blog })); await fetchBlogs(); setFormState(initialState); } } catch (err) { console.log("error creating blog: ", err); } }; return (

    Amplify Todos

    Create Blog {blogs && blogs?.listBlogs?.items?.map((blog, index) => { return (

    {blog?.name}

    {blog?.body}

    ); })}
    ); }; const styles = { container: { width: 400, margin: "0 auto", display: "flex", //real weird issue: https://github.com/cssinjs/jss/issues/1344 flexDirection: "column" as "column", justifyContent: "center", padding: 20, }, todo: { marginBottom: 15 }, input: { border: "none", backgroundColor: "#ddd", marginBottom: 10, padding: 8, fontSize: 18, }, todoName: { fontSize: 20, fontWeight: "bold" }, todoDescription: { marginBottom: 0 }, button: { backgroundColor: "black", color: "white", outline: "none", fontSize: 18, padding: "12px 0px", }, }; export default App;
  • Gatsby JS — How to solve FOUC when using tss-react and Material UI v5
    4 projects | dev.to | 29 Jan 2022
    Material UI v5 brought some amazing updates, but switching from JSS to Emotion had an arguably nasty side-effect: it was no longer as straightforward to group your component styles in classes. Fortunately, a fantastic library emerged that allowed developers to not only reduce the extreme pain from migrating all their classes from v4's makeStyles to emotion, but to also to continue to writing classes in practically the same syntax, with wonderful TS type-safety. This library was tss-react, and it was one of my favorite open source discoveries of 2021.
  • Feel like that studying as a self-taught is taking me further than studying at university
    2 projects | /r/webdev | 25 Oct 2021
    I started writing a long response, but I want to add that a simple CRA + JSS + TS (named exports only) stack solves or abstracts away most of these issues.
  • What is CSS in JS?
    1 project | dev.to | 17 Sep 2021
    JSS

What are some alternatives?

When comparing css-in-js and JSS you can also consider the following projects:

vanilla-extract - Zero-runtime Stylesheets-in-TypeScript

emotion - 👩‍🎤 CSS-in-JS library designed for high performance style composition

crisp-react - React boilerplate written in TypeScript with a variety of Jamstack and full stack deployments. Comes with SSR and without need to learn a framework. Helps to split a monolithic React app into multiple SPAs and avoid vendor lock-in.

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

linaria - Zero-runtime CSS in JS library

React CSS Modules - Seamless mapping of class names to CSS modules inside of React components.

Sass - Sass makes CSS fun!

ESLint - Find and fix problems in your JavaScript code.

tss-react - ✨ Dynamic CSS-in-TS solution, based on Emotion

Rollup - Next-generation ES module bundler

styled-jsx - Full CSS support for JSX without compromises