Skip to content
StyleX

StyleX

Meta's build-time atomic CSS-in-JS: type-safe, collision-free, themeable

Tier S · Best in classToolPrimitivestylexjs.com

Preview image from stylexjs.com

StyleX is the styling system Meta built for facebook.com and Instagram and open-sourced under MIT. You write style objects in JavaScript or TypeScript; a Babel or PostCSS compiler extracts them at build time into atomic CSS classes, so merging styles is predictable — the last style applied always wins, with no specificity wars and no runtime cost. It ships variables and theming primitives (defineVars, createTheme) for design tokens, plus plugins for Next.js, Vite, Webpack, Rspack, esbuild and Bun, an ESLint rule set and a CLI. It is for large codebases where component styles must compose across team boundaries without leaking.

Install
npm install --save @stylexjs/stylex

For an agent

Choose StyleX over Tailwind when styles must be typed and composable across package boundaries — a component library whose consumers need to override styles safely is the case it wins outright, since merge order is deterministic rather than specificity-dependent. It is a compiler, not a runtime, so the build config is the hard part: scaffold with `npm create @stylexjs my-app`, or wire the right plugin (Next.js, Vite, Webpack, Rspack, esbuild) before writing a single style. Do not mix it into an existing Tailwind project casually, and expect `unstable_` config keys — it is still pre-1.0 despite Meta running it in production.

Why it is here. The most credible answer to 'CSS-in-JS but with zero runtime cost', proven at facebook.com and Instagram scale and MIT-licensed.

Install command, framework, licence and component list.

Facts

License
MIT
Pricing
Free, Open source
Framework
React, Next.js, SvelteKit, Vanilla JS
Styling
StyleX, CSS-in-JS, CSS custom properties
Distribution
npm package, CLI installer, GitHub repository
Platform
Web
Content type
Code, Design tokens / theme files
Agent readiness
Readable open source, Structured documentation, CLI installable
Accessibility
Not applicable
Maturity
Actively maintained
GitHub stars
9,738
Package
@stylexjs/stylex

Notable for

  • powers facebook.com and Instagram
  • build-time atomic CSS extraction
  • deterministic style merging, no specificity wars
  • typed design tokens via defineVars and createTheme
  • plugins for Next.js, Vite, Webpack, Rspack, esbuild and Bun

Provenance

Verified 2026-08-15. HTTP 200. https://stylexjs.com/, https://stylexjs.com/docs/learn/installation/ (install command, supported bundlers, create-stylex scaffold), https://github.com/facebook/stylex (monorepo packages, MIT), GitHub API for stars/licence/last push

Also in Component Libraries

6
stylexjs.comTier S