Open-source project
vanilla-extract-css/vanilla-extract avatar
vanilla-extract-css/vanilla-extract

vanilla-extract: what leaves your bundle, and what does not

Zero-runtime Stylesheets-in-TypeScript

10,455 stars363 forksTypeScriptMIT

At a glance

What is it?
vanilla-extract turns TypeScript files into static CSS at build time, scoping class names and CSS variables the way CSS Modules does. The interesting part is the boundary it draws: everything in a .css.ts file is evaluated away and never ships, and runtime theming is a separate opt-in API rather than something the core gives you.
Who is it for?
vanilla-extract is the right choice if you want TypeScript tooling over your styles and would rather ship no style-related JavaScript, with dynamic runtime theming available only through an optional API.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • vanilla-extract-css/vanilla-extract10,455 ★ · +27
Star history
Repository2026-09-222026-11-25
vanilla-extract-css/vanilla-extract10.4k10.5k

27 Stars in the last 64 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

A .css.ts file is evaluated away, so none of its code reaches the bundle

The whole design rests on one promise: once you have configured your build tooling, these files are evaluated at build time and none of the code inside them is included in your final bundle. The mental model offered is using TypeScript as your preprocessor instead of Sass or Less. A minimal file looks like this:

ts
// styles.css.ts

import { createTheme, style } from '@vanilla-extract/css';

export const [themeClass, vars] = createTheme({
  color: {
    brand: 'blue'
  },
  font: {
    body: 'arial'
  }
});

export const exampleStyle = style({
  backgroundColor: vars.color.brand,
  fontFamily: vars.font.body,
  color: 'white',
  padding: 10
});

The consumer then imports the exported names and never touches the object literals:

ts
// app.ts

import { themeClass, exampleStyle } from './styles.css.ts';

document.write(`
  <section class="${themeClass}">
    <h1 class="${exampleStyle}">Hello world!</h1>
  </section>
`);

Notice the import specifier carries the .css.ts extension rather than resolving to a .ts file. That is the tell that these are not ordinary modules.

createTheme returns a class name and a vars object in one destructuring

The destructuring in that example is the API's signature. createTheme takes a nested object of design tokens and returns a tuple: a class name to apply to a wrapper element, and a vars object carrying the same values as locally scoped CSS custom properties. Styles then reference vars.color.brand or vars.font.body instead of hardcoded literals, and the theme class is what activates those variables for that subtree. The scoping extends past class names. Along with locally scoped CSS variables, the project scopes @keyframes and @font-face rules locally, so two files declaring the same animation name do not collide. Above that sits a high-level theme system that supports simultaneous themes and carries the note No globals. For readers coming from CSS Modules, the comparison the project makes is that this is CSS Modules in TypeScript with scoped CSS variables added on top.

Runtime theming is opt-in, which is both the feature and the limitation

Two features are explicitly labelled optional, and they are the two that break the zero-runtime rule. One is an optional runtime version for development and testing. The other is an optional API for dynamic runtime theming. Everything else is build time. The README labels the dynamic runtime theming API as optional and separate from the build-time core.

Type safety comes from CSSType, so mistakes are compile errors

Style objects are typed through CSSType, which means the keys and values you write are checked against CSS property types rather than passed through as opaque strings. A misspelled property or an invalid value is a type error at build time, which sits oddly next to the stated goal of a minimal abstraction over standard CSS. The abstraction is minimal in the sense that the output is plain CSS: static files, standard properties, standard custom properties. It is not minimal in the sense that you write ordinary CSS text, because you write an object literal instead. The other stated capability in the same area is a set of utils for generating variable-based calc expressions, so arithmetic on design tokens is expressed through those helpers rather than by concatenating strings into a calc() value yourself.

Nothing runs until build tooling understands the .css.ts extension

There is no install command in the README, and that omission is the first real obstacle. Setup guides and API documentation live on the documentation site, and the README's own instruction is to check there after configuring your build tooling, which it treats as a completed prerequisite rather than something it walks you through. If you arrive expecting a quickstart with an install line, you will not find one. The cost is a setup step that has to be resolved before the promise in the first example means anything: until the toolchain evaluates .css.ts at build time, importing themeClass and exampleStyle gives you nothing usable. The project also points at a runnable example rather than a local setup path, with a CodeSandbox tree for the webpack-react example whose styles live at src/App.css.ts. The repository carries a next example as well, so the two integrations the examples directory demonstrates are webpack with React and Next.js.

The repository root is a private 0.0.0 workspace, not the package you install

package.json at the root declares name vanilla-extract, version 0.0.0, private set to true, author SEEK, and license MIT. That is a monorepo root rather than a published artifact, and the real packages live under packages/. The version numbers that matter are per scoped package, and the recent releases show three separate version lines moving independently: @vanilla-extract/integration at 8.0.11, @vanilla-extract/css at 1.21.3, and @vanilla-extract/turbopack-plugin at 0.1.4. The consequence for anyone tracking versions is that there is no single vanilla-extract version to reason about, and the core CSS package, the integration package and the Turbopack plugin are on different version lines. Build tooling for the workspace comes from pnpm with pnpm-workspace.yaml and pnpm-lock.yaml, and packages are built with preconstruct through the dev, build, and watch scripts.

Linting is split into four passes and the runner is told not to bail

The lint script is pnpm run --no-bail '/^lint:.*/', which fans out to four separate checks: lint:manypkg running manypkg check over the workspace, lint:prettier running prettier --cache --check ., lint:tsc running tsc, and lint:oxlint running oxlint. The no-bail flag matters, because it means the aggregate lint command does not stop at the first failing pass, so you get a full picture across all four rather than a single blocker. Formatting is a different pipeline entirely, oxlint --fix && prettier --write ., so the linter can rewrite code and Prettier settles the layout afterwards. There is a .prettierignore for the exclusions. Testing splits into unit coverage through vitest run and browser coverage through Playwright, and the Playwright path depends on a preparatory step: test:build-next runs a copy-next-plugin script before building the Next.js fixtures.

The lineage runs through treat, css-in-js-loader, and Stitches

The credits explain where the design came from. Nathan Nam Tran is thanked for creating css-in-js-loader, which served as the initial starting point for treat, described as the precursor to this library, and SEEK is thanked for giving the space to do the work. Stitches is credited separately, for getting the team excited about CSS Variables in JS before the project existed. SEEK is also the listed author in package.json, and the license is MIT.

Editorial conclusion

vanilla-extract is the right choice if you want TypeScript tooling over your styles and would rather ship no style-related JavaScript, with dynamic runtime theming available only through an optional API. Before committing, check three things: that you can configure build tooling for a .css.ts extension, which documentation does not cover in the README and sends you to vanilla-extract.style; that your team accepts the version-per-package model, since the root package is private at 0.0.0 and each scoped package versions separately; and that the CSS property coverage CSSType gives you matches the properties your design system actually uses.

Frequently asked questions

how to use vanilla extract

In the CSS library sense, you write styles in .css.ts files, export class names from createTheme and style, and configure your build tooling so those files are evaluated at build time. The README does not contain an install command and sends you to the documentation site for setup guides.

Does vanilla-extract ship any JavaScript to the browser?

No code inside a .css.ts file is included in your final bundle once build tooling is configured. There is an optional runtime version for development and testing, and an optional API for dynamic runtime theming, but everything else is generated at build time.

How does vanilla-extract handle themes and CSS variables?

createTheme returns a class name and a vars object, and styles reference the vars as locally scoped CSS custom properties. The project describes a high-level theme system supporting simultaneous themes, with no globals, and it scopes CSS variables, @keyframes, and @font-face rules locally.

What license and author does vanilla-extract carry?

It is released under the MIT license, and package.json lists SEEK as the author. The repository root package is private and versioned 0.0.0, while the published scoped packages version independently.

What is Sprinkles and how does it relate to vanilla-extract?

Sprinkles is described as the official zero-runtime atomic CSS framework built on top of vanilla-extract, aimed at working at a higher level while maximising style re-use.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. vanilla-extract-css/vanilla-extract on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/vanilla-extract-css-vanilla-extract.svg)](https://hysenlabs.com/projects/vanilla-extract-css-vanilla-extract)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/vanilla-extract-css-vanilla-extract.svg)](https://hysenlabs.com/projects/vanilla-extract-css-vanilla-extract)

Was this useful?