← Back to articles

The End of CSS-in-JS (2026)

CSS-in-JS (styled-components, Emotion) was the default for React apps from 2018-2023. In 2026, it's dying. Here's why.

What Happened

The Performance Problem

CSS-in-JS libraries inject styles at runtime. This means:

  • JavaScript parses and generates CSS on every render
  • Styles are computed in the browser, not at build time
  • Larger JavaScript bundles (library code + style definitions)
  • Slower Time to Interactive

Benchmarks showed 20-50% slower rendering compared to static CSS approaches.

React Server Components Killed It

Server Components don't run in the browser. CSS-in-JS libraries require a browser runtime. They're fundamentally incompatible.

styled-components and Emotion require 'use client' on every component that uses them. This defeats the purpose of Server Components.

The Migration Wave (2023-2025)

ProjectMigrated FromMigrated To
Mantine v7EmotionCSS Modules
Chakra UI v3EmotionPanda CSS (build-time)
MUIEmotionPigment CSS (build-time)
Next.js docsstyled-jsxTailwind CSS
Vercelstyled-componentsTailwind CSS

When the component libraries themselves abandon CSS-in-JS, the signal is clear.

What Replaced It

1. Tailwind CSS (Winner)

// No runtime. No JavaScript. Just class names.
<div className="flex items-center gap-4 p-6 bg-white dark:bg-gray-900 rounded-lg shadow">
  <h2 className="text-xl font-bold">Title</h2>
</div>

Why it won: Zero runtime cost. Works with Server Components. Utility classes are composable. shadcn/ui proved it scales.

2. CSS Modules

import styles from './Card.module.css'

<div className={styles.card}>
  <h2 className={styles.title}>Title</h2>
</div>

Why it works: Zero runtime. Scoped by default. Standard CSS. No library needed.

3. Build-Time CSS-in-JS

Panda CSS, Vanilla Extract, and Pigment CSS generate static CSS at build time:

// Panda CSS — looks like CSS-in-JS, but compiles to static CSS
import { css } from '../styled-system/css'

<div className={css({ display: 'flex', gap: '4', padding: '6' })}>

Why it works: Developer experience of CSS-in-JS without the runtime cost.

The Numbers

ApproachRuntime JSBuild TimeRSC Compatible
styled-components~12KBFast
Emotion~11KBFast
Tailwind CSS0KBFast
CSS Modules0KBFast
Panda CSS0KBSlower
Vanilla Extract0KBSlower

Should You Migrate?

Yes, if:

  • Starting a new project (use Tailwind)
  • Adopting React Server Components
  • Performance is a priority

Not yet, if:

  • Existing app works fine with CSS-in-JS
  • No plans for Server Components
  • Migration cost outweighs benefits

FAQ

Is styled-components dead?

Not dead, but declining. It still works for client-only React apps. For new projects, Tailwind or CSS Modules are better choices.

What about Tailwind's readability?

It's an adjustment. After a week, most developers prefer utility classes. Component extraction and cn() helper functions keep things clean.

Will CSS-in-JS come back?

Build-time CSS-in-JS (Panda CSS, Vanilla Extract) is the evolution. Runtime CSS-in-JS is unlikely to return.

Bottom Line

CSS-in-JS had a good run (2018-2023). Runtime style injection is incompatible with the Server Components future. Tailwind CSS is the default for new React projects. CSS Modules for teams that prefer traditional CSS. Panda CSS / Vanilla Extract for teams that want the CSS-in-JS DX without the runtime cost. The migration is happening — the only question is when you'll make the switch.

Get AI tool guides in your inbox

Weekly deep-dives on the best AI coding tools, automation platforms, and productivity software.