On this page
Overview
vanilla-extract is a styling library that defines styles in TypeScript or JavaScript and generates static CSS during the build. Code in .css.ts files can produce locally scoped classes, CSS variables, themes, keyframes, and other CSS constructs with type safety while remaining frontend-framework agnostic.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Generate locally scoped CSS classes from TypeScript
Calling style() in a .css.ts file produces static CSS and a locally scoped class name during the build, allowing style definitions to stay out of the application's runtime bundle.
Model CSS variables and themes as typed objects
APIs such as createTheme map design tokens to CSS variables so colors, typography, spacing, and related values can be referenced through TypeScript while still using standard CSS primitives.
Sources: [2]
Best fit
Before adoption
A bundler integration is required
The core package does not make .css.ts files work in a normal build by itself. A Vite, webpack, esbuild, or other supported integration must be configured for the target toolchain.
Sources: [4]
Do not use the Vite plugin as a library-build integration
The official Vite guide targets web applications and explicitly says library builds are unsupported. Published libraries should use an integration designed for that workflow, such as the Rollup plugin. The current core package metadata reports version 1.21.2.
Official sources
- [1]vanilla-extract repository(2026-09-30)
- [2]vanilla-extract README(2026-09-30)
- [3]@vanilla-extract/css package metadata(2026-09-30)
- [4]vanilla-extract getting started(2026-09-30)
- [5]vanilla-extract Vite integration(2026-09-30)
- [6]vanilla-extract MIT license(2026-09-30)
Supplemental curator note
vanilla-extract is especially useful when teams want typed design tokens and style definitions without runtime CSS-in-JS. Build-tool integration is part of the architecture, and application and library builds may require different plugins.
Try it in 3 steps
- 1
Install the core package and Vite plugin
Add the core package and Vite integration. Use the matching integration package when the project uses a different bundler.
npm install @vanilla-extract/css npm install --save-dev @vanilla-extract/vite-plugin - 2
Configure the Vite plugin
Add the plugin to vite.config.js or vite.config.ts so .css.ts files are processed during the build.
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'; export default { plugins: [vanillaExtractPlugin()] }; - 3
Create a style in a .css.ts file
Import the generated class name into application code and verify that the build emits static CSS.
import { style } from '@vanilla-extract/css'; export const container = style({ padding: 10 });
Growth
Growth trends · Last 30 days
10,435 Stars
Trend data is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
- Stars
- 10,435
- Forks
- 359
- Watchers
- 34
- Open issues
- 74
- Owner type
- Organization
- Primary language
- TypeScript
- License
- MIT
- Repository last updated
- Sep 27, 2026
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Biome25,880 Stars
3 shared tag(s) · 1 shared category(s)
combine formatting, linting, fixes, and editor diagnostics in one fast tool
Rust - Redux61,488 Stars
2 shared tag(s) · 2 shared category(s) · Same language
make shared-state updates explicit with stores/actions/reducers, while modern code uses Toolkit
TypeScript - Signature Pad12,047 Stars
2 shared tag(s) · 2 shared category(s) · Same language
draw smooth signatures on HTML5 canvas and export PNG, JPEG, SVG, or point data
TypeScript - React Native126,760 Stars
2 shared tag(s) · 2 shared category(s)
native mobile UI with React, stable 0.87.1, and a framework-first path
C++ - Angular101,027 Stars
2 shared tag(s) · 1 shared category(s) · Same language
Unify components, signals/DI, routing, forms, SSR/hydration, and CLI tooling in one TypeScript web application platform
TypeScript - Playwright96,900 Stars
2 shared tag(s) · 1 shared category(s) · Same language
Drive Chromium, Firefox, and WebKit through one API and test runner for E2E, scripting, and agent browser automation
TypeScript
Report incorrect information
Tell us if any listing information is incorrect or outdated.