vercel

vercel/styled-jsx

JavaScript MIT Web Dev low-activity-window

Full CSS support for JSX without compromises

7.8k stars
267 forks
recent
GitHub

7.8k

Stars

267

Forks

83

Open issues

30

Contributors

v5.1.7 30 Apr 2025

AI Analysis

styled-jsx is a CSS-in-JS library that provides scoped, component-friendly styling for JSX with full CSS support, working in both server-side and client-side rendering. It's specifically designed for React applications and developers who want encapsulated styles without CSS conflicts. Best suited for React projects prioritizing style isolation and developer experience; not ideal for teams preferring traditional CSS files or other CSS-in-JS approaches like Emotion or styled-components.

Web Dev Library Discovery value: 3/10
Documentation 8/10
Activity 6/10
Community 8/10
Code quality 6/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 7/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

css-in-js react-styling jsx-scoped-css babel-plugin component-styles
Well documented MIT licensed Popular Niche/specialized use case Beginner friendly Production ready
Deep Analysis · Based on README and public signals
2w ago

Vercel's scoped CSS-in-JSX library remains alive but faces an uphill battle in a mature CSS-in-JS market

styled-jsx provides full, scoped CSS inside JSX components via a Babel/SWC transform, injecting unique classnames at build time to achieve style isolation without runtime overhead. It was built primarily for Next.js users seeking a zero-config, familiar CSS syntax within components. Vercel bundles it as the default CSS-in-JS solution for Next.js (Pages Router), which gives it substantial passive adoption. However, as the ecosystem has shifted toward CSS Modules, Tailwind, and the App Router, its organic growth has stalled. It remains technically functional and actively maintained, but its strategic importance within the Next.js ecosystem has diminished.

Origin

Created by Vercel in December 2016 to solve CSS scoping in React SSR contexts. It shipped as the built-in styling solution for Next.js Pages Router, giving it a large captive user base. The project has been stable for years with only maintenance updates.

Growth

Growth was almost entirely driven by Next.js adoption rather than standalone interest. As Next.js popularity surged, so did passive styled-jsx usage. However, with Next.js App Router defaulting to CSS Modules and React Server Components discouraging CSS-in-JS at runtime, the pull toward styled-jsx has weakened noticeably since 2022-2023. Stars have flatlined at roughly 7.8k with only 2 gained in the last 7 days.

In production

Strong indirect adoption evidence via Next.js Pages Router, which automatically configures styled-jsx. Millions of Next.js projects have likely used it passively. Direct standalone adoption is less documented. npm download counts would be substantial due to Next.js bundling, though this conflates bundled usage with intentional adoption.

Code analysis
Architecture

Appears to use a Babel plugin (and SWC transform for Next.js) to perform compile-time CSS extraction and classname injection. Likely generates unique scope hashes per component. Runtime module is reportedly 3kb gzipped and handles style deduplication and SSR flushing. The transform approach means minimal runtime cost compared to fully runtime CSS-in-JS solutions.

Tests

not documented in README

Maintenance

Last push was 2026-06-09, approximately 17 days before the evaluation date, indicating the project is actively maintained. Maintenance appears routine — keeping up with dependencies and Next.js compatibility — rather than feature-driven. CI badge is present and active.

Honest verdict

ADOPT IF: you are maintaining an existing Next.js Pages Router codebase that already uses styled-jsx and migration cost is not justified. AVOID IF: you are starting a new React or Next.js project — CSS Modules, Tailwind, or Emotion are better-supported defaults with broader community momentum. MONITOR IF: you are tracking whether Vercel continues investing in it as Next.js App Router matures, as the project's long-term strategic role within Vercel's stack is uncertain.

Independent dimensions

Mainstream potential

2/10

Technical importance

6/10

Adoption evidence

6/10

Risks
  • Declining strategic relevance within Next.js as the App Router and React Server Components ecosystem moves away from runtime CSS-in-JS patterns.
  • Babel dependency may create friction as the broader ecosystem moves toward SWC and other non-Babel toolchains, though a SWC plugin appears to exist for Next.js.
  • Limited ecosystem growth: plugins, integrations, and community content are unlikely to expand significantly given flat adoption trajectory.
  • Dynamic styling capabilities are constrained compared to styled-components or Emotion, which may frustrate developers with complex theming needs.
  • Maintainer concentration risk: as a Vercel-owned project primarily maintained in service of Next.js, if Vercel deprioritizes it, community-driven maintenance may not fill the gap.
Prediction

styled-jsx will likely persist in maintenance mode, kept alive for Next.js Pages Router backward compatibility, but is unlikely to regain growth momentum or become a recommended choice for new projects.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

JavaScript
100%
TypeScript
0%

Information

Language
JavaScript
License
MIT
Last updated
1mo ago
Created
117mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Similar repos

emotion-js

emotion-js/emotion

Emotion is a CSS-in-JS library optimized for high-performance style composition...

18k JavaScript Web Dev
styled-components

styled-components/styled-components

styled-components is a CSS-in-JS library for React that enables scoped, dynamic...

41.1k TypeScript Web Dev
facebook

facebook/stylex

StyleX is a JavaScript styling library for building optimized user interfaces,...

9.6k JavaScript Web Dev
vercel

vercel/next.js

Next.js is a full-stack React web framework maintained by Vercel that supports...

140.6k JavaScript Web Dev
vercel

vercel/satori

Satori is a TypeScript library that converts HTML and CSS into SVG, designed...

13.6k TypeScript Web Dev
vs. alternatives
styled-components

styled-components offers a richer API with theming, dynamic props, and a large ecosystem, but has a higher runtime cost and historically struggled with SSR performance. styled-jsx is lighter and more aligned with plain CSS syntax but lacks the component abstraction model.

emotion

Emotion offers both styled and css-prop APIs with strong performance and SSR support. It has broader community adoption and framework-agnostic use. styled-jsx's advantage is its zero-config integration into Next.js; outside that context, Emotion is generally preferred.

CSS Modules

CSS Modules are now the de facto standard in Next.js App Router. They offer zero runtime cost, familiar syntax, and broad tooling support. They lack dynamic styling capabilities but cover most use cases, making styled-jsx harder to justify for new projects.

facebook/stylex

StyleX from Meta takes a more constrained, static-first approach to scoped styles. It is growing in adoption for large-scale apps needing strict style predictability. styled-jsx is less constrained but also less scalable in large codebases.

Tailwind CSS

Tailwind dominates new Next.js project starts. It solves scoping via utility classes rather than CSS-in-JS. Tailwind and styled-jsx serve different mental models, but Tailwind's community momentum makes styled-jsx a less natural starting point for new developers.