Tailwind CSS v4: Why I Chose CSS-First Config Over Styled Components

Published: (December 6, 2025 at 01:49 AM EST)
4 min read
Source: Dev.to

Source: Dev.to

Introduction

I’ve been building React components for years, trying every styling solution: CSS Modules, Styled Components, Emotion, Sass, and Tailwind v3. When Tailwind CSS v4 alpha landed with its revolutionary Oxide engine and CSS‑first configuration, I knew something fundamental had shifted.

  • Build times: 12 s → 1.2 s (10× faster)
  • Hot module replacement: 500 ms → Fast, type‑safe, and maintainable styling.

Evaluation Criteria

CriterionWeight
Build Performance30 %
Runtime Performance25 %
Developer Experience20 %
Maintainability15 %
Ecosystem10 %

Each tool is rated 1‑5 ★ per criterion, then weighted.

Tailwind CSS v4 (Oxide Engine)

What it is: A Rust‑based CSS framework with CSS‑first configuration using @source and @theme directives—no tailwind.config.js.

Innovation

  • Oxide Engine: 10× faster than v3 (Rust vs JavaScript)
  • CSS‑First: Configuration via @theme in CSS, not JS
  • @source: Scans directories for classes directly in CSS
  • Native CSS: Full support for variables, container queries, etc.

Stats

  • GitHub Stars: 82k+ ⭐
  • NPM Downloads: 10 M+/week 📦
  • Version: 4.0.0 (stable as of Dec 2024)
  • Bundle Size: 8‑15 KB gzipped (tree‑shaken)

Key Features

@import 'tailwindcss';          /* single import, no config file */
@source './src';                /* scan directories for classes */
@theme {
  --color-primary: blue;
}
  • Lightning‑fast builds with Oxide
  • Full PostCSS compatibility

Best for: New projects, performance‑critical apps, design systems wanting CSS‑native configuration.

Tailwind CSS v3 (Traditional Approach)

What it is: JavaScript‑configured utility‑first CSS framework with a JIT engine and extensive plugin ecosystem.

Stats

  • GitHub Stars: 82k+ ⭐
  • NPM Downloads: 10 M+/week 📦
  • Version: 3.4.15 (stable, mature)
  • Language: JavaScript + PostCSS

Pros & Cons

ProsCons
✅ Mature, battle‑tested❌ Slower than Oxide (≈10×)
✅ Massive plugin ecosystem❌ JS config complexity (200+ lines)
✅ Universal knowledge❌ HMR slower (≈500 ms)
✅ JIT engine still fast❌ Missing native @theme

Best for: Existing projects, teams needing stability and specific v3‑only plugins.

Styled Components (CSS‑in‑JS)

What it is: Library that writes CSS in JavaScript using tagged template literals.

import styled from 'styled-components';

const Button = styled.button`
  background: ${props => (props.primary ? 'blue' : 'gray')};
  padding: 1rem 2rem;
  border-radius: 0.5rem;
`;

Stats

  • GitHub Stars: 40k+ ⭐
  • NPM Downloads: 3.5 M/week 📦
  • Version: 6.1.13
  • Bundle Size: ~16 KB runtime + styles

Pros & Cons

ProsCons
✅ True component scoping❌ Runtime overhead (styles computed at runtime)
✅ Dynamic styling with JS logic❌ Larger bundle (~16 KB + styles)
✅ TypeScript support❌ Performance impact (style injection)
✅ Automatic vendor prefixing❌ SSR complexity (style extraction)
✅ Theme provider❌ No build‑time optimization

Best for: Apps needing heavy dynamic styling, component libraries where scoping is critical.

CSS Modules (Classic Approach)

What it is: Traditional CSS with scoped class names generated by bundlers.

/* Button.module.css */
.button {
  background: blue;
  padding: 1rem 2rem;
}
.primary {
  background: darkblue;
}
import styles from './Button.module.css';

Click

Stats

  • Bundle Size: Only your CSS (smallest possible)
  • Performance: Zero runtime, pure CSS

Pros & Cons

ProsCons
✅ Zero runtime overhead❌ No type safety (class name strings)
✅ Smallest bundle size❌ Manual design‑system tokens
✅ Automatic scoping (unique class names)❌ Verbose (separate files)
✅ Standard CSS syntax❌ No utility classes
✅ Works everywhere (native Vite/Webpack)❌ Hard to maintain design consistency

Best for: Small projects, teams comfortable with traditional CSS, need absolute smallest bundle.

Other CSS‑in‑JS Option (Performance‑Focused)

What it is: Framework‑agnostic CSS‑in‑JS library similar to Styled Components but lighter.

  • GitHub Stars: 17k+ ⭐
  • NPM Downloads: 2.5 M/week 📦
  • Version: 11.11.0
  • Bundle Size: ~7 KB runtime

Pros & Cons

ProsCons
✅ Smaller than Styled Components (~7 KB)❌ Still runtime CSS‑in‑JS (injection cost)
✅ Better performance than Styled Components❌ Smaller community
✅ Framework‑agnostic❌ SSR complexity

Best for: Performance‑conscious CSS‑in‑JS users, multi‑framework projects.

Feature Comparison

FeatureTailwind v4Tailwind v3Styled ComponentsCSS ModulesOther CSS‑in‑JS
Build Speed⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Runtime Perf⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
HMR Speed⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Type Safety⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
DX (Ease of Use)⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Bundle Size⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Maintainability⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Config Simplicity⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Design System⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Ecosystem⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
CommunityGrowingMassiveLargeUniversalMedium
Learning CurveLowestLowMediumLowMedium

Test Setup

  • Project: Portfolio app with 50+ components
  • Files: 180 TypeScript/TSX files
  • Styles: Design system with 15 color tokens, 8 spacing scales
  • Machine: MacBook Pro M2, 16 GB RAM
  • Date: December 2025

Benchmark Results

Build & HMR Performance

ToolInitial BuildRebuild (HMR)Production Build
Tailwind v41.2 s85 ms2.8 s
Tailwind v312.4 s520 ms8.1 s
Styled Components8.7 s380 ms12.3 s
CSS Modules2.1 s120 ms3.2 s
Emotion7.2 s320 ms10.5 s

Winner: Tailwind v4 (10× faster than v3, 7× faster than Styled Components).

Bundle Size (gzipped)

ToolCSS OutputJS RuntimeTotal
Tailwind v412.3 KB0 KB12.3 KB
Tailwind v314.1 KB0 KB14.1 KB
Styled Components18.7 KB16 KB34.7 KB
CSS Modules8.2 KB0 KB8.2 KB
Emotion15.3 KB7 KB22.3 KB

Winner: CSS Modules (smallest), Tailwind v4 (best utility‑framework size).

Runtime Metrics

ToolFirst PaintTotal Blocking TimeStyle Recalc
Tailwind v40.8 s0 ms12 ms
Tailwind v30.8 s0 ms14 ms
Styled Components1.2 s35 ms28 ms
CSS Modules0.7 s0 ms10 ms
Emotion1.0 s22 ms18 ms

Winner: CSS Modules (pure CSS), Tailwind v4 (best utility‑framework performance).

Conclusion

Tailwind CSS v4 isn’t just “faster Tailwind”; it represents a fundamental rethinking of how CSS frameworks should work in 2025:

  • Performance: Orders‑of‑magnitude faster builds and HMR.
  • Configuration: Pure‑CSS, eliminating bulky JavaScript config.
  • Maintainability: Simpler, type‑safe theming via @theme.
  • Ecosystem: Growing community with Rust‑based tooling.

For new, performance‑critical applications—or any project that can adopt the CSS‑first paradigm—Tailwind v4 is the clear choice. Existing projects may still benefit from the stability of Tailwind v3, while CSS‑in‑JS and CSS Modules remain viable for niche use‑cases requiring dynamic styling or absolute minimal bundles.

Back to Blog

Related posts

Read more »