MCPcopy Create free account
hub / github.com/vanilla-extract-css/vanilla-extract

github.com/vanilla-extract-css/vanilla-extract @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
482 symbols 1,633 edges 333 files 6 documented · 1% 48 cross-repo links updated today@vanilla-extract/vite-plugin@5.2.5 · 2026-07-14★ 10,40043 open issues

Browse by type

Functions 399 Types & classes 83
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

🧁 vanilla-extract

Zero-runtime Stylesheets-in-TypeScript.

Write your styles in TypeScript (or JavaScript) with locally scoped class names and CSS Variables, then generate static CSS files at build time.

Basically, it’s “CSS Modules-in-TypeScript” but with scoped CSS Variables + heaps more.

🔥   All styles generated at build time — just like Sass, Less, etc.

✨   Minimal abstraction over standard CSS.

🦄   Works with any front-end framework — or even without one.

🌳   Locally scoped class names — just like CSS Modules.

🚀   Locally scoped CSS Variables, @keyframes and @font-face rules.

🎨   High-level theme system with support for simultaneous themes. No globals!

🛠   Utils for generating variable-based calc expressions.

💪   Type-safe styles via CSSType.

🏃‍♂️   Optional runtime version for development and testing.

🙈   Optional API for dynamic runtime theming.


🌐 Check out the documentation site for setup guides, examples and API docs.


🖥   Try it out for yourself in CodeSandbox.


Write your styles in .css.ts files.

// 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
});

💡 Once you've configured your build tooling, these .css.ts files will be evaluated at build time. None of the code in these files will be included in your final bundle. Think of it as using TypeScript as your preprocessor instead of Sass, Less, etc.

Then consume them in your markup.

// app.ts

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

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

Want to work at a higher level while maximising style re-use? Check out 🍨 Sprinkles, our official zero-runtime atomic CSS framework, built on top of vanilla-extract.


Thanks

  • Nathan Nam Tran for creating css-in-js-loader, which served as the initial starting point for treat, the precursor to this library.
  • Stitches for getting us excited about CSS-Variables-in-JS.
  • SEEK for giving us the space to do interesting work.

License

MIT.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 349
Interface 64
Method 50
Class 19

Languages

TypeScript100%

Modules by API surface

packages/compiler/src/compiler.ts32 symbols
packages/css/src/transformCss.ts28 symbols
packages/vite-plugin/src/index.ts22 symbols
packages/css/src/conditionalRulesets.ts13 symbols
packages/integration/src/processVanillaFile.ts12 symbols
packages/css/src/adapter.ts11 symbols
site/src/DocsPage/DocsPage.tsx10 symbols
packages/webpack-plugin/src/compiler.ts10 symbols
packages/turbopack-plugin/src/next-font/transform.ts9 symbols
packages/css/src/style.ts9 symbols
packages/rollup-plugin/src/index.ts8 symbols
packages/css/src/vars.ts8 symbols

Used by 3 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

@babel/core7.23.9 · 1×
@babel/plugin-syntax-typescript7.23.3 · 1×
@babel/preset-env7.23.9 · 1×
@babel/preset-react7.23.3 · 1×
@babel/preset-typescript7.23.3 · 1×
@changesets/changelog-github0.6.0 · 1×
@changesets/cli2.30.0 · 1×
@docsearch/css3.3.3 · 1×
@docsearch/react3.3.3 · 1×
@emotion/hash0.9.0 · 1×
@fixtures/featuresworkspace:* · 1×

For agents

$ claude mcp add vanilla-extract \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page