AI summary by TwinMind
This new Tailwind feature is scarier than I thought
Theo - t3․gg
29m 13s
Introduction & Context
- Theo discusses being fond of Tailwind despite initial skepticism
- Focus on Naman's blog post critiquing Tailwind V4 beta
- Naman: creator of StyleX, respected for performant styling methods at Meta
- Theo planned video on Naman's Tailwind critiques but hadn't gotten to it
Sponsor Segment - Code Rabbit
- AI-powered code review tool demonstration
- Shows PR summarization, walkthrough features, and line-by-line suggestions
- Free for open source projects
- Promo code: Theo1M for first month free
Tailwind V4 Positive Changes
Lightning CSS Migration
- Good move toward Rust-based tooling
- Performance improvements substantial but not critical (JIT already fast)
- Main benefit: unification of Tailwind imports and syntax lowerings
- Eliminates manual autoprefixer configuration
CSS-First Configuration
- Mixed reception - not complete slam dunk
- Benefits: one fewer boilerplate file for getting started
- Downsides: custom syntax specific to Tailwind, no longer type-safe
- Can still import old JS config with
@config - Should be good move long-term
CSS Theme Variables
- Architecturally obvious win using real CSS variables
- Performance concerns: inconsistent issues when reassigning variables or defining on non-root elements
- Reference to previous "Tailwind broke" video about Chrome performance optimizations breaking text highlighting
- Most devs use global themes, scoped overrides uncommon
- Inlining variables might be better default
Native CSS Cascade Layers
- Unmitigated success and obvious win
- Surprise it wasn't already implemented
- Simple polyfill for older browsers without support
Simplified Theme Config
- Values like
grid-cols-73now work without brackets - Good move removing unnecessary boilerplate
- Theo's concern: loses clarity between built-in system vs custom values
- Distinction matters more for design system elements (sizes, colors) than structural elements (columns)
Controversial Changes
Gradient Support
- Added radial and conic gradient support
- Naman: "Tailwind has never handled gradients well"
- Complex syntax doesn't belong directly in HTML
- Should be part of design system with named gradients
- Current approach requires copy-pasting complex class combinations across codebase
- Uses CSS variables under the hood (problematic)
- Suggestion: ship with predefined beautiful gradients, allow custom config
New Variants (not: and in:)
- Support for
not:andin:variants - Good improvements maintaining atomic style guarantees
- Enable better control without breaking atomic principles
Child Selector Variants (Concerning)
*:and**:variants for targeting children- Problem: encourages bad practices Tailwind previously discouraged
- Breaks atomic CSS principles by styling at distance
- Makes CSS harder to maintain - styles defined away from affected elements
- Reduces reusability - elements can't be moved and behave consistently
*:(direct children) already problematic**:(all descendants) much worse - "styling at a distance"- Example:
**:data-[avatar]:rounded-fullaffects any descendant with data-avatar - Naman: "jumped the shark", no longer atomic CSS
- Theo's take: useful for CMS content but should be behind flag like "dangerously set inner HTML"
Technical Issues
Class Name Prefixes Problem
- Tailwind usually has prefixes (bg-, m-, pt-) indicating style type
- Recent trend removing prefixes: flex, grid, grow, shrink
- Impact on Tailwind merge performance
- CSS order matters for specificity, not HTML class order
- Tailwind merge needs to remove conflicting classes
- Prefix checking more efficient than custom conflict resolution
- Over 1/3 of Tailwind projects use Tailwind merge
- Tailwind team discourages merge, prefers static application
- Alternative solutions (data attributes, important) make components less reusable
REM Units Usage (Accessibility Anti-pattern)
- Default theme uses REM for everything: font size, spacing, sizing, media queries
- Problem: REM based on default font size
- When users change browser font size, everything scales (not just text)
- Breaks user expectation that font size setting only affects text
- Forces users into mobile-like layout when they want larger text
- Should use pixels for spacing, sizing, media queries
- REM only appropriate for font sizes
- Exception: height containers for text elements should use REM to match text height
React vs Tailwind Team Philosophy
- Tailwind success partly due to React's lack of good native styling solution
- Tailwind team PHP/Rails focused, not React enthusiasts
- Don't want to be JS library, npm just best distribution method
- Explains resistance to client-side JS concerns like Tailwind merge
- Moving to CSS config reflects desire to be language-agnostic
Conclusion & Recommendations
- Article focuses on negatives because positives obvious
- Constructive criticism for massive community impact
- Naman upgraded Tailwind-to-StyleX for V4 compatibility
- Double star variant should be rolled back or flagged as dangerous
- Native Tailwind merge/class variance authority better than double star
- Tailwind V4 great overall but concerning trends toward traditional CSS problems
