theme-ui VS stitches

Compare theme-ui vs stitches and see what are their differences.

theme-ui

Build consistent, themeable React apps based on constraint-based design principles (by system-ui)

stitches

[Not Actively Maintained] CSS-in-JS with near-zero runtime, SSR, multi-variant support, and a best-in-class developer experience. (by stitchesjs)
Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
theme-ui stitches
19 80
5,209 7,678
0.7% 0.2%
8.4 3.9
28 days ago 3 months ago
TypeScript 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.

theme-ui

Posts with mentions or reviews of theme-ui. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-11-03.
  • Styling React 2023 edition
    11 projects | dev.to | 3 Nov 2023
    Over the past few years, I've worked with React apps utilising various CSS-in-JS libraries, starting with styled-components, transitioning through emotion, Theme UI, and finally Stitches. I've also integrated MUI, Mantine, and Chakra in numerous client projects.
  • The Future of CSS: Easy Light-Dark Mode Color Switching with Light-Dark()
    5 projects | news.ycombinator.com | 9 Oct 2023
    > If you wanted to actually solve theming, what you should work for is not a constrained helper function like light-dark(), but instead a shared token schema. Today nearly every company has their own token schema and different ways of naming things in the semantic token layer. If we had a shard language here, not only would it be trivial to add light/dark theming (just redefine a few variables that are already provided for you), code could be shared between sites and inherit the theming/branding.

    Isn't that the idea behind https://open-props.style/ (and https://theme-ui.com/ in JS land)?

    I think it's a great idea, but hampered by the lack of adoption incentives for the very people that need to adopt it for it to become successful (design system/component library authors). It introduces constraints, but the promised interoperability is not really beneficial to the people who need to work within those constraints.

  • Making a Linux home server sleep on idle and wake on demand – the simple way
    5 projects | news.ycombinator.com | 19 Apr 2023
    Author here, apologies for the dark mode issue and thanks for flagging it -- looks to be an open bug in theme-ui (https://github.com/system-ui/theme-ui/issues/1602).

    I've just pushed a workaround that appears to have fixed it.

  • Past Informs the Present: Begin’s Approach to CSS
    9 projects | dev.to | 10 Jan 2023
    Note how each class in the atomic version maps to just a single CSS property and value. In fact, if I hadn’t included the second block, I bet you’d have had no problem determining each class’ effect from the markup alone! This is a hallmark of atomic CSS — the effect of a class is typically self evident from its name alone, whereas the specifics of a class name like media are more ambiguous.

    For anyone familiar with atomic CSS today, the example above will likely appear unremarkable. The transition towards this approach was anything but, however — and on some corners of the web today, debate still rages about whether atomic CSS has been the best or worst thing to happen to styling on the web since CSS.

    There was, however, clearly an appetite for this approach amongst a non-trivial swath of web developers: the year 2014 saw the release of both Adam Morse’s Tachyons and Brent Jackson’s Basscss, the first two frameworks to go all-in on atomic CSS. These frameworks were instrumental in writing the blueprints for the atomic CSS methodology and turning the status quo on its head — and indeed, the shift was so monumental that, within a number of years, ‘utility-first’ CSS frameworks started becoming multimillion dollar businesses.

    The atomization of CSS had officially begun.

    Atomic CSS: successes and perceived failures

    In order to understand the success of atomic CSS (even if that success remains a point of debate in some circles), we should first examine its principles, and the goals those principles seek to achieve. Many of these principles are derived from functional programming, hence the alternative name ‘functional CSS’. Additional inspiration came from the Unix philosophy.

    The most fundamental principles of atomic CSS are:

    Classes should have a single purpose.
    Classes should do one thing, and they should do it well. This makes each class more reusable. A class that applies a margin, and only a margin, is more reusable than a class that applies and margin and a text colour.
    A class’ effect should be self evident.
    There should be no mystery about the effect of using a class — clarity should always trump cleverness. The effect of a class named flex which sets the display property to flex is self evident. The effect of a class named media which may set any number of property values is ambiguous.
    Classes should be composable.
    Complex styles should be achieved by composing multiple single purpose classes together, rather than by writing new, complex, and less reusable classes.
    Classes should be immutable and free of side effects.
    For example, the underline class should only ever apply an underline style. It should never not apply the underline, or apply another style, or change any other property of any other element. Under no circumstances should it change the effect of another class.

    It’s important to note that these principles were not devised for their own sake — each plays an important role in authoring performant, maintainable, robust styles:

    • Single purpose classes are more reusable and composable than multipurpose classes. Thus, single purpose classes provide greater flexibility as well as reduced CSS file sizes, both at the outset of new projects and throughout their lifecycle (as fewer styles need to be added to deliver iterations and additions to UI).

    • Classes with singular, self evident effects reduce cognitive overhead for developers; the resultant styling systems are thus easier to learn, and this in turn helps frontend teams scale their efforts across people and time.

    • Classes which are immutable and free of side effects result in fewer bugs — and where bugs occur, easier debugging and resolution follows.

    In these ways and in others, I have always felt that the nature of atomic CSS flows very much with the grain of CSS itself. Remember that CSS was designed to be independent of markup, and atomic CSS is by design untethered to any particular markup structure or content based semantics. Atomic CSS also honors CSS’ specificity algorithm rather than attempting to game it — it does not concern itself with optimized selector ranking or scope, since every class is of single purpose and equal specificity. This also means CSS’ inheritance model becomes an advantage as it was originally intended: compositions can be built up with inheritance in mind, over several layers of markup.

    There are, however, many common objections raised against the atomic CSS methodology. In general, these tend to be:

    ’It’s not semantic.’
    We’ve touched on this already, but it’s worth repeating: semantics, accessibility, and clarity do matter, but with all due respect to Zeldman, there is nothing inherently unsemantic, inaccessible, or unclear about ‘visual class names’, nor is there a reason for CSS to map to the same semantics as HTML.
    ‘This is inline styles all over again.’
    Nope. Inline styles are defined in HTML; atomic classes are defined in a style sheet. Inline styles do not permit media queries, pseudo elements, or pseudo classes; atomic classes do. Inline styles have a specificity ranking of 1-0-0-0, which can only be outranked by !important; atomic classes have a specificity of 0-0-1-0, the same as any single class. An inline style’s source of truth is its own singular invocation on a given element; an atomic class’ source of truth is a style sheet. There is a lexical resemblance between class='red' and style='color: red'; this is where the similarities end.
    ‘Putting so many classes on my elements looks ugly/is hard to read.’
    Admittedly, doesn’t read like poetry (and yes, that snippet is taken from this very page as of this writing). However, something that is a delight is being able to rapidly iterate on this composition — from the logical origin of that composition (the markup), whether in the browser or my editor — to explore different combinatorial spaces within the bounds of a design system. Iterating in this fashion simply cannot be matched when using other methodologies.
    ‘This is so not DRY.’
    It’s true, atomic CSS can lead to repeating declarations of various styling rules — but I vastly prefer repeating declarations to repeating definitions (which, in my experience, are much harder to maintain). Also, remember that every time you repeat a class name, that’s one more addition you didn’t have to make to your style sheet! Ultimately, this is a matter of choosing what kind of repetition you want, not one of avoiding repetition altogether.
    ‘Atomic CSS is at odds with modern component modeling.’
    ‘Thinking in React’ is one of those articles that changed the way I thought about web development when it was published, and there’s no denying that building frontends on the web has become a component centric process. However, it’s important to differentiate the process of thinking in components and the process of styling components. A conceptual abstraction does not require an equivalent material abstraction, and the fact of a component’s existence does not necessitate a dedicated CSS class.
    ‘This still doesn’t solve the problem of global scope or one off styles.’
    It doesn’t, and in fact atomic CSS is not designed for this. For scoped or one off styles, a different approach is absolutely required.

    Atomic CSS can provide a fantastic foundation that covers the vast majority of styling needs for a given website and its constituent components, and it can deliver those styles in a fraction of the file size and complexity of other methodologies. To be clear, these claims are not theoretical: this has been my experience both as a contributor and leader of frontend teams over the past 8 years, and the same has been true for many others both within and outside of my professional circle. But as we’ve noted, atomic CSS doesn’t cover every use case: scoped and one off styles are not part of its wheelhouse. So what’s to be done when a need for these sorts of styles emerges?

    Going bespoke

    Photograph of a blacksmith working metal at a grinder.
    Photo by Chris Ralston on Unsplash

    Where one off styles are needed, or where we want to ensure certain styles are scoped to a given component, additional measures beyond an atomic CSS methodology will be required. There are several techniques that can be used to address these concerns, with a few notable examples having become more popular in recent years:

    CSS in JS
    The obvious contender in this list. I used CSS in JS for many years myself, and have to say the developer ergonomics are pretty impressive, as is the ability to leverage both repeatable and bespoke, scoped styles (especially when using libraries like Styled System or Theme UI). Unfortunately, great developer ergonomics and scoping are not enough. CSS in JS can add significant weight to client side bundles, along with increased setup complexity (especially when server side rendering is involved). Some solutions can also lock you in to certain frontend frameworks, limiting the portability of your styles. There are some solutions emerging to address these concerns (e.g. Vanilla Extract), but at the end of the day, I admit I’m growing tired of learning abstractions of CSS — there are so many more valuable things I could be doing with my time. This isn’t necessarily a popular opinion, but I think CSS is actually pretty amazing on its own, and the closer to the metal I can stay, the happier I am.
    CSS Modules
    The name may suggest that CSS Modules are part of the CSS spec, but this is not the case. CSS Modules allow authors to extract styles from a vanilla .css file and into a JavaScript file containing markup; at build time, these extracted styles are then regenerated as locally scoped styles wherever they are used. This seems to offer some of the benefits of CSS in JS, but without the ergonomics of colocating styles, content, and behavior within a given component.
    Shadow DOM
    Shadow DOM is a web standards specification which is designed to provide encapsulation of content, styles, and behavior — but it has a number of hard to swallow caveats. For one, Shadow DOM roots need to be initialized in JavaScript (though Declarative Shadow DOM should address this in the future.) Further, styling encapsulation doesn’t work quite like you think it does, and this can cause some headaches. I believe the Shadow DOM holds promise, but for many use cases, it can end up being more trouble than it’s worth.

    Fortunately, a compelling solution for dealing with scoped and one off styles exists in the form of HTML custom elements, which are part of the web components spec along with Shadow DOM and HTML templates. I may be biased, but I think the best way to work with custom elements right now is with Enhance (though to be fair, I got a sneak peak at Enhance before joining Begin in 2022, and was just as enthusiastic at that time).

    Using Enhance to author custom elements in the form of Single File Components (SFCs) has a number of huge benefits:

    1. Custom elements are expanded on the server, providing great performance and an excellent baseline for progressive enhancement on the client.

    2. Locally scoped, one off styles can be authored simply by including a </code> block in your SFC. When your component is expanded on the server, these style blocks will be hoisted into the document head, with all of that style block’s selectors scoped to your custom element. This allows for one off styles to be encapsulated and scoped to the component they’re authored in, without needing to touch the Shadow DOM. Scoped styles written within an SFC are also a great place to leverage strategies like <a href="https://css-tricks.com/are-we-in-a-new-era-of-web-design-what-do-we-call-it/">intrinsic design</a>, which can happily coexist alongside a global, atomic class system.</p></li> <li><p>If you don’t need to write client side behavior, <strong>you never have to interface with JavaScript classes or the <a href="https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry">Custom Elements Registry</a></strong>. This is particularly handy for engineers (or designers) who might excel at HTML and CSS but lack experience in JavaScript. Although SFCs are authored as JavaScript functions, the bulk of the authored code is written in HTML and CSS, as seen below:<br> </p></li> </ol> <div class="highlight js-code-highlight"> <pre class="highlight javascript"><code><span class="c1">// my-button.mjs</span> <span class="k">export</span> <span class="k">default</span> <span class="kd">function</span> <span class="nx">MyButton</span><span class="p">({</span> <span class="nx">html</span> <span class="p">})</span> <span class="p">{</span> <span class="k">return</span> <span class="nx">html</span><span class="s2">` <style> /* One off styles applied only to button elements rendered by MyButton. */ /* Any button outside this component will not be affected. */ button { appearance: none; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } ` } // index.html <my-button>Click Me!</my-button>

  • Best open source components library for ReactJS?
    10 projects | /r/reactjs | 9 Jan 2023
  • Migrating my website from Gatsby to Astro
    13 projects | dev.to | 25 Nov 2022
    theme-ui
  • "Tailwind is an Anti-Pattern" by Enrico Gruner (JavaScript in Plain English)
    5 projects | /r/webdev | 19 Jul 2022
    Recently, we've been using theme-ui for styles (which uses emotion behind the scenes).
  • best styling DX for component libraries with design tokens
    4 projects | /r/reactjs | 16 Jul 2022
    I am a huge fan of design tokens which is popularized by styled-system (unmaintained?) and theme-ui Interested in finding out how to achieve the best DX for building a new design system.
  • What is Rebass and How to provide theming to Rebass Components? ⚛️
    2 projects | dev.to | 27 Apr 2022
    We know that React handles the user interfaces of around 10 million websites across the globe. No doubt, the base library of React is robust, so there are multiple component libraries like MUI, Antdesign, Rebass, ThemeUI, and more which provide valuable design elements. Rebass is the simple UI component library of React which is highly composable and built with styled-components to keep styles isolated. Many react js developers use React Rebass over Theme UI. Because Rebass components are reusable primitive components, they are ready to go out with the box with the best default styles. Moreover, all the rebass components are basically Box components that consist of a style system to give you the ability to style through props.
  • [MongoDB Submission Post Placeholder Title]
    3 projects | dev.to | 13 Jan 2022
    Theme-UI, it made setting up the layout super straightforward 💯

stitches

Posts with mentions or reviews of stitches. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-11-03.
  • Styling React 2023 edition
    11 projects | dev.to | 3 Nov 2023
    Over the past few years, I've worked with React apps utilising various CSS-in-JS libraries, starting with styled-components, transitioning through emotion, Theme UI, and finally Stitches. I've also integrated MUI, Mantine, and Chakra in numerous client projects.
  • HyperUI: Free Open Source Tailwind CSS Components
    3 projects | news.ycombinator.com | 11 Aug 2023
    Radix has some great ideas that challenge the way components are usually built. I'd love to use it, but am somewhat burned by how Stitches stopped being maintained due to the changes in React 18. Context: https://github.com/stitchesjs/stitches/discussions/1149#disc...

    To be clear, it's not so much that they decided to not spend time, energy and money into maintaining it, but that there's seemingly been very little (if any) interest in letting others maintain it despite several people expressing interest. I'm sure it's scare handing over commit access, but if you're giving it up anyway then why not just do it, see what happens? Instead it's just dead in the water.

    I'd happily pay license fees to use Radix and/or Stitches, if that guarantees maintenance. Sadly that's not an option it seems.

  • I created a Zero-Runtime CSS-in-JS Library Compatible with Next.js App Router and RSC
    4 projects | dev.to | 16 May 2023
    Some libraries, such as Stitches, claim near-zero runtime performance overhead by tackling the first issue (parsing JavaScript CSS objects). Nevertheless, they still inject the parsed CSS into the DOM at runtime, which means they haven’t entirely eliminated the performance concerns.
  • what's the best way for styling our components in react?
    3 projects | /r/reactjs | 11 Feb 2023
    Stitches allows you to map your design system
  • What are ways we can integrate our designers into our React projects?
    2 projects | /r/reactjs | 3 Feb 2023
    Define strict system of colors, spaces, etc then attempt to synchronize usage of it in both design and code (tools like https://vanilla-extract.style/ or https://stitches.dev/ can help with enforcing system on software side)
  • Introducing DecaUI
    3 projects | /r/reactjs | 25 Jan 2023
    There are some issues with SSR and NextJS in React 18: https://github.com/stitchesjs/stitches/issues/863
  • Getting started with NextUI and Next.js
    6 projects | dev.to | 25 Jan 2023
    According to the docs, NextUI is a React UI library that allows you to make beautiful, modern, and fast websites/applications regardless of your design experience. It is created with React and Stitches, based on React Aria, and inspired by Vuesax.
  • Top 3 React UI Libraries in 2023
    4 projects | dev.to | 21 Jan 2023
    Stitches CSS customization
  • CSS JOURNEY #1 - Stitches
    2 projects | dev.to | 17 Jan 2023
    I am a big supporter of basically everything that Vercel does. When I saw their projects being made with Radix and Stitches I had to try it. Here is how it went.
  • What is your development stack for 2023?
    10 projects | /r/node | 9 Jan 2023
    typescript + styling with stitches

What are some alternatives?

When comparing theme-ui and stitches you can also consider the following projects:

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

Tailwind CSS - A utility-first CSS framework for rapid UI development.

chakra-ui - ⚡️ Simple, Modular & Accessible UI Components for your React Applications

Material UI - Ready-to-use foundational React components, free forever. It includes Material UI, which implements Google's Material Design.

tailwind - 🔥 A schematic that adds Tailwind CSS to Angular applications

styled-system - ⬢ Style props for rapid UI development

twind - The smallest, fastest, most feature complete Tailwind-in-JS solution in existence.

headlessui - Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.

react-select - The Select Component for React.js

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