vlabs
Design

From Lunaria to Tailwind: migrating a design system

Shubham Singh
Shubham SinghFounder
August 28, 20267 min read
From Lunaria to Tailwind: migrating a design system

When VLabs adopted the initial scaffolding from Twenty CRM's open-source codebase, it came with a styling system built on Linaria — a zero-runtime CSS-in-JS library. The component styles were written as tagged template literals, colocated with JSX, and extracted at build time. It's a solid system. It just wasn't ours, and it wasn't built for what we were doing with it.

VLabs runs on Next.js 16 with the App Router. Linaria has historically had friction with RSC (React Server Components) and the App Router's streaming model. Beyond the technical mismatch, there was a simpler reason: the rest of the codebase we were writing used Tailwind utilities, and maintaining two styling systems in one repo is a tax that compounds fast — every new contributor has to learn both, and every component lives in a slightly different mental model.

The decision was made: migrate the entire inherited component library from Linaria to Tailwind CSS v4. All of it, in one pass.

The scope

The inherited code covered roughly 60+ component files — buttons, headings, section shells, cards, the navigation system, testimonial carousels, footer, tokens, and the full design system layer (colour schemes, spacing scale, type ramp). Every one of those files had Linaria css or styled calls that needed to become Tailwind class strings.

On top of the mechanical rewrite, the design identity needed updating. Twenty CRM's visual language is clean but it's a CRM product — professional, neutral, enterprise. VLabs needed to feel like an educational lab tool: the same structural rigour, different personality. New colours, new type choices, new token names.

How it was done

Tool used

OpenCode CLI with Claude Opus 4.6 via Amazon Bedrock. The entire migration ran as a single long agentic session — reading files, rewriting them, verifying TypeScript, iterating on broken builds. Total cost: approximately $50 in API credits. For context, a manual migration of this scope would have taken the better part of a week.

The migration was handed to an AI coding agent with a clear brief: convert every Linaria styled call to a Tailwind class string, preserve the CSS custom property theming system (the scheme variables —--surface, --ink, --ink-muted, etc.), and keep TypeScript compiling clean throughout. The agent worked file by file, reading the Linaria output, mapping it to equivalent Tailwind v4 utilities, and rewriting.

What couldn't be expressed in utility classes — deeply nested child selectors, prose typography, scheme-switching via data-scheme attributes — was moved into globals.css as plain CSS using Tailwind's @layer directive. This is the right call: Tailwind is a utility system, not a replacement for every possible CSS pattern.

What went well

  • The token system translated cleanly. CSS custom properties like var(--color-blue) and var(--spacing-base) work natively inside Tailwind's arbitrary value syntax — bg-[var(--color-blue)], p-[calc(var(--spacing-base)*4)]. No token system rewrite needed, just new syntax around the same variables.
  • The scheme-switching architecture survived intact. The three colour schemes (light, muted, dark) work by swapping CSS custom properties on data-scheme attribute selectors in globals.css. Tailwind doesn't touch those selectors — they live in plain CSS and work exactly as before.
  • TypeScript compilation stayed clean. Because Tailwind classes are plain strings, there's no type layer to maintain. The codebase went from complex Linaria type inference to simple string[] arrays joined with .join(" ").
  • Build times dropped noticeably. Linaria's babel-based extraction added meaningful overhead to both dev and production builds. Tailwind v4's CSS-first engine is significantly faster.

What broke

  • Dynamic class generation. Linaria allowed fully dynamic styles — interpolate any JavaScript expression into the CSS. Tailwind's JIT engine requires class names to be statically detectable. A handful of components needed refactoring to use CSS custom properties for the dynamic parts instead of fully dynamic class strings.
  • Complex pseudo-selector chains. Some Linaria styles used deeply nested &:hover > span > svg chains that don't have clean Tailwind equivalents. These moved to scoped <style> blocks inside the component, which is the documented escape hatch for exactly this case.
  • First-pass class verbosity. Tailwind class strings for complex layout components are long. The agent occasionally generated strings that were functionally correct but harder to read than the original Linaria. A second pass consolidated these into arrays with comments.

The result

A fully migrated component library with no Linaria dependency, a consistent Tailwind v4 utility pattern throughout, and a custom design identity built on top of the token system. The total time from decision to working build was a single day. The total cost was around $50 in API credits.

Whether that's expensive or cheap depends on what you compare it to. A manual migration of this scope — reading Linaria output, mapping properties, handling edge cases, keeping TypeScript happy — would have taken days. The agent made mistakes, but they were the kind of mistakes that are fast to catch and fix, not the kind that hide in production.

The migration also made it easier for contributors. Tailwind is something most frontend developers already know. Linaria is not. Lowering the barrier to understanding how a component is styled is worth something on an open-source project.

If you're curious about the architecture that came out the other side — the token system, the scheme-switching, the component patterns — it's all in the docs, and the source is open on GitHub.