linear.app · Free post · Execution, roadmaps & process · Product design & UX

Styling Linear for the future with StyleX

LinearAug 26, 20268 min
Sourcelinear.app
KindFree post
PublishedAug 26, 2026
Originallinear.app ↗
N:

Linear migrated its React codebase from styled-components to StyleX over 1,000+ PRs, combining deterministic tooling, AI agents, and human judgment. The move addressed performance issues (20-35% CPU reduction on view-heavy pages), reduced runtime style injection, and created explicit styling boundaries to prevent regressions and support agent-generated code. The migration required careful risk management, team adoption strategies, and custom enforcement tooling to maintain consistency at scale.

01Key takeaways

  • Build-time style generation eliminates runtime overhead; Linear saw 20-35% CPU reduction and zero CSS rule injection during navigation.
  • Constrain styling APIs deliberately to prevent regressions; explicit contracts and deterministic merging are easier to reason about at scale than convention-based flexibility.
  • Scope agent work narrowly with validation scripts, examples, and checklists; agents struggled with visual validation until newer models (Fable, Sol) improved mid-migration.
  • Start migrations with leaf components to reduce cascade interactions and learn in lower-risk areas before touching shared primitives.
  • Make migration progress visible through tooling (counters, graphs, highlighting) to build team momentum and prevent regressions via bots.
  • Extend constrained systems pragmatically; CSS Modules and custom ThemeProviders handled edge cases StyleX didn't support directly.

02Key sections

Why StyleX over styled-components
styled-components' flexibility became a liability as the team grew and UI regressions multiplied after redesigns. StyleX's build-time style generation, deterministic merging, and deliberate constraints on styling-at-a-distance aligned with Linear's need for clearer component boundaries and better performance, especially as agents contribute more code.
Making the migration tractable
Linear built a deterministic codemod as the foundation, starting with a large test suite and architecture that agents then extended. The codemod handled cross-file selectors and edge cases, while agents were scoped narrowly with validation scripts and checklists. Migration began with leaf components to reduce risk and cascade interactions.
Derisking coexistence
styled-components and StyleX coexisted during the transition to avoid freezing product work. Linear defined the StyleX foundation first, spawned agents with clear scopes and validation, and started with low-risk components. Manual testing was needed until newer agent models (Fable, Sol) could validate visual differences reliably.
Building team momentum
Linear made migration progress visible through a dev-toolbar counter tracking remaining styled-components, visual highlighting of migrated vs. unmigrated components, continuous progress graphs, and a bot that flagged new styled-components in PRs. These tactics encouraged adoption and prevented regressions.
Enforcing StyleX conventions
Custom lint rules and a repository-aware type checker enforced styling patterns across the codebase, covering migration cleanup, component APIs, style composition, design consistency, and theme safety. Rules prevented old patterns from returning and caught subtle merge issues that per-file linters would miss.
Extending StyleX pragmatically
Linear used CSS Modules as a scoped fallback for CSS-shaped problems and extended StyleX's theming to support dynamic, context-aware color derivation. Themes are generated from base inputs and regenerate across subtrees (selected rows, focus states, menus) via a custom ThemeProvider that injects scoped CSS rules at runtime.
“CSS already makes it too easy to style things at a distance, and patterns like styled(Button) made it normal to reopen a component from the…”Linear · linear.app
“Migrations seem like a natural fit for coding agents because much of the work is repetitive, but this one had too many edge cases to…”Linear · linear.app

03Frameworks mentioned

Summary and takeaways written by PM Atlas; quotes are short excerpts. © the original author.