Installation
Get Tokenami up and running in your project with these simple steps. Tokenami offers a CLI tool for generating static styles, a lightweight CSS utility for authoring styles, and a TypeScript plugin for enhanced developer experience.Quick Start
Jump right in with our Vite starter template, or follow the steps below to configure your own project.Prerequisites
Tokenami requires Node.js version 20 or higher and TypeScript 5+.
- Node.js >= 20
- TypeScript >= 5
- A package manager (npm, pnpm, or yarn)
Step 1: Install Packages
Tokenami consists of two packages:tokenami- CLI tool and TypeScript plugin (dev dependency)@tokenami/css- Runtime CSS utility (~2.5kb gzipped)
Step 2: Initialize Your Project
Run the Tokenami initializer to create the required configuration files:.tokenami/tokenami.config.ts- Your design system configuration.tokenami/tokenami.env.d.ts- TypeScript declarations for autocomplete
Step 3: Configure TypeScript
Update yourtsconfig.json (or jsconfig.json for JavaScript projects) to include the Tokenami TypeScript plugin and type definitions:
tsconfig.json
Editor Setup
For the best developer experience, configure your editor:VS Code
Create or update.vscode/settings.json:
.vscode/settings.json
- String completions - Get autocomplete while typing CSS variable names
- Faster suggestions - Filter out irrelevant matches
- Accurate matching - Prioritize suggestions that match your typing
Tokenami officially supports VS Code, Cursor, Windsurf, and Zed.
Step 4: Configure Your Theme
Customize your design tokens in.tokenami/tokenami.config.ts:
.tokenami/tokenami.config.ts
Name your theme groups and tokens however you like. These names become part of your CSS variables (e.g.,
var(--color_slate-100)).Step 5: Build Your Styles
Run the Tokenami CLI to generate your stylesheet:- Scans files matching your
includepatterns - Generates atomic CSS rules based on your usage
- Watches for changes in development
- Outputs a static CSS file
Add this command to your
package.json scripts for convenience:Step 6: Link Your Stylesheet
Reference the generated CSS file in the<head> of your HTML document:
app/layout.tsx
Verify Your Setup
Create a test component to verify everything is working:src/App.tsx
- Autocomplete suggestions when typing CSS variable names
- Type errors if you use non-existent tokens
- Styles applied to your component
Optional: Use the Official Design System
Skip custom theme setup by using the official Tokenami design system, which includes:- Global CSS reset (based on Tailwind’s Preflight)
- Radix UI colors with automatic dark mode
- Fluid spacing and typography (responsive by default)
- RTL support built-in
- Shorthand aliases (
--pfor padding,--mfor margin, etc.)
.tokenami/tokenami.config.ts
Troubleshooting
TypeScript Errors Not Showing
If you don’t see TypeScript errors for invalid tokens, make sure:- Your editor is using the workspace TypeScript version
- The
pluginsfield is correctly set intsconfig.json - You’ve restarted your editor after making config changes
Styles Not Applying
If styles aren’t showing up:- Check that the CSS file is being generated at the correct path
- Verify the stylesheet is linked in your HTML
- Make sure the CLI watcher is running (
--watchflag) - Check your
includepatterns match your source files
Autocomplete Not Working
If autocomplete isn’t appearing:- Enable string suggestions in your editor settings
- Make sure
.tokenami/tokenami.env.d.tsis included in yourtsconfig.json - Try restarting your TypeScript server (VS Code:
Cmd/Ctrl+Shift+P→ “Restart TS Server”)
What’s Next?
Now that you have Tokenami installed, learn how to build your first component in the quickstart guide.Quickstart
Build your first styled component with Tokenami