Installation
A token package that makes design values like colors, spacing, and typography consistent across every environment.
Install
# npm
npm install @7onic-ui/tokens
# yarn
yarn add @7onic-ui/tokens
# pnpm
pnpm add @7onic-ui/tokensImport
CSSCSS variables only
@import '@7onic-ui/tokens/css/all.css';Individual imports
@import '@7onic-ui/tokens/css/variables.css';
@import '@7onic-ui/tokens/css/themes/light.css';
@import '@7onic-ui/tokens/css/themes/dark.css';<html class="dark"> enables semantic colors to automatically switch to the dark theme.
Tailwind v4
@import "tailwindcss";
@import '@7onic-ui/tokens/tailwind/v4.css';Individual imports
@import "tailwindcss";
@import '@7onic-ui/tokens/css/variables.css';
@import '@7onic-ui/tokens/css/themes/light.css';
@import '@7onic-ui/tokens/css/themes/dark.css';
@import '@7onic-ui/tokens/tailwind/v4-theme.css';v4-theme.css is required for bg-primary and duration-fast classes to work.
Tailwind v3CSS + preset
@import '@7onic-ui/tokens/css/all.css';
@tailwind base;
@tailwind components;
@tailwind utilities;Individual imports
@import '@7onic-ui/tokens/css/variables.css';
@import '@7onic-ui/tokens/css/themes/light.css';
@import '@7onic-ui/tokens/css/themes/dark.css';
@tailwind base;
@tailwind components;
@tailwind utilities;module.exports = {
presets: [
require('@7onic-ui/tokens/tailwind/v3-preset')
],
}The preset uses theme.extend, so your existing Tailwind classes remain intact. ※ Semantic color opacity modifiers (bg-primary/50, etc.) also work in v3 via RGB channel variables.
JavaScript / TypeScriptStatic values
import { colors, spacing, typography } from '@7onic-ui/tokens'Both ESM (.mjs) and CJS (.js) are supported. TypeScript type definitions are included.
Usage Reference
Reference the available tokens and their formats.
Colors
--color-primarybg-primarycolors.primary[600]--color-secondarybg-secondarycolors.secondary[600]--color-successbg-successcolors.green[600]--color-warningbg-warningcolors.yellow[500]--color-errorbg-errorcolors.red[600]--color-background-mutedbg-background-mutedCSS only ※--color-texttext-foregroundCSS only ※--color-text-mutedtext-text-mutedCSS only ※--color-primary-texttext-primary-foregroundCSS only ※--color-borderborder-borderCSS only ※| CSS Variable | Tailwind | JS / TS |
|---|---|---|
| --color-primary | bg-primary | colors.primary[600] |
| --color-secondary | bg-secondary | colors.secondary[600] |
| --color-success | bg-success | colors.green[600] |
| --color-warning | bg-warning | colors.yellow[500] |
| --color-error | bg-error | colors.red[600] |
| --color-background-muted | bg-background-muted | CSS only ※ |
| --color-text | text-foreground | CSS only ※ |
| --color-text-muted | text-text-muted | CSS only ※ |
| --color-primary-text | text-primary-foreground | CSS only ※ |
| --color-border | border-border | CSS only ※ |
Typography
--font-size-2xs (11px)text-2xsfontSize["2xs"]--font-size-xs (12px)text-xsfontSize.xs--font-size-sm (13px)text-smfontSize.sm--font-size-md (14px)text-mdfontSize.md--font-size-base (16px)text-basefontSize.base--font-size-lg (18px)text-lgfontSize.lg--font-size-xl (20px)text-xlfontSize.xl--font-size-2xl (24px)text-2xlfontSize["2xl"]| CSS Variable | Tailwind | JS / TS |
|---|---|---|
| --font-size-2xs (11px) | text-2xs | fontSize["2xs"] |
| --font-size-xs (12px) | text-xs | fontSize.xs |
| --font-size-sm (13px) | text-sm | fontSize.sm |
| --font-size-md (14px) | text-md | fontSize.md |
| --font-size-base (16px) | text-base | fontSize.base |
| --font-size-lg (18px) | text-lg | fontSize.lg |
| --font-size-xl (20px) | text-xl | fontSize.xl |
| --font-size-2xl (24px) | text-2xl | fontSize["2xl"] |
Spacing
--spacing-1 (4px)p-1 m-1 gap-1spacing[1]--spacing-2 (8px)p-2 m-2 gap-2spacing[2]--spacing-4 (16px)p-4 m-4 gap-4spacing[4]--spacing-6 (24px)p-6 m-6 gap-6spacing[6]--spacing-8 (32px)p-8 m-8 gap-8spacing[8]| CSS Variable | Tailwind | JS / TS |
|---|---|---|
| --spacing-1 (4px) | p-1 m-1 gap-1 | spacing[1] |
| --spacing-2 (8px) | p-2 m-2 gap-2 | spacing[2] |
| --spacing-4 (16px) | p-4 m-4 gap-4 | spacing[4] |
| --spacing-6 (24px) | p-6 m-6 gap-6 | spacing[6] |
| --spacing-8 (32px) | p-8 m-8 gap-8 | spacing[8] |
Duration
--duration-fast (100ms)duration-fastduration.fast--duration-micro (150ms)duration-microduration.micro--duration-normal (200ms)duration-normalduration.normal--duration-slow (300ms)duration-slowduration.slow--duration-slower (400ms)duration-slowerduration.slower| CSS Variable | Tailwind | JS / TS |
|---|---|---|
| --duration-fast (100ms) | duration-fast | duration.fast |
| --duration-micro (150ms) | duration-micro | duration.micro |
| --duration-normal (200ms) | duration-normal | duration.normal |
| --duration-slow (300ms) | duration-slow | duration.slow |
| --duration-slower (400ms) | duration-slower | duration.slower |
Radius / Shadow / Z-Index
--radius-{sm|md|lg|...}rounded-{sm|md|lg|...}borderRadius.*--shadow-{xs|sm|md|lg|xl}shadow-{xs|sm|md|lg|xl}shadow.*--z-index-{modal|tooltip|...}z-{modal|tooltip|...}zIndex.*| CSS Variable | Tailwind | JS / TS |
|---|---|---|
| --radius-{sm|md|lg|...} | rounded-{sm|md|lg|...} | borderRadius.* |
| --shadow-{xs|sm|md|lg|xl} | shadow-{xs|sm|md|lg|xl} | shadow.* |
| --z-index-{modal|tooltip|...} | z-{modal|tooltip|...} | zIndex.* |
Custom Utilities
--icon-size-{xs|sm|md|lg|xl}icon-{xs|sm|md|lg|xl}iconSize.*--scale-{50|75|pressed}scale-{50|75|pressed}scale.*--opacity-{0~100}opacity-{0~100}opacity.*--easing-{ease|ease-in|...}ease-{in|out|in-out}easing.*--color-focus-ringfocus-ringCSS only ※@keyframes {name}animate-{name}CSS only ※| CSS Variable | Tailwind | JS / TS |
|---|---|---|
| --icon-size-{xs|sm|md|lg|xl} | icon-{xs|sm|md|lg|xl} | iconSize.* |
| --scale-{50|75|pressed} | scale-{50|75|pressed} | scale.* |
| --opacity-{0~100} | opacity-{0~100} | opacity.* |
| --easing-{ease|ease-in|...} | ease-{in|out|in-out} | easing.* |
| --color-focus-ring | focus-ring | CSS only ※ |
| @keyframes {name} | animate-{name} | CSS only ※ |
--spacing-4, etc.) are fixed values. Semantics (--color-primary, etc.) switch between light/dark themes.Package Contents
Import the files you need. All are generated by npx sync-tokens automatically.
@7onic-ui/tokensDistribution files + CLI + AI + source
css/all.cssRecommendedcss/variables.csscss/themes/light.csscss/themes/dark.csstailwind/v4.cssRecommendedtailwind/v3-preset.jstailwind/v4-theme.cssjs/index.jsCJSjs/index.mjsESMtypes/index.d.tsTypeScript typesjson/tokens.jsonFlat JSONcli/sync.jsnpx sync-tokensllms.txtAI Integrationfigma-tokens.jsonSSOTThe only file you need to edit
figma-tokens.json — edit, then run npx sync-tokens to regenerate all files automatically.
Token Sync
Update your design in Figma → propagate to all files with one CLI command
Figma
Edit design
JSON
Export
CLI
sync-tokens
Output
All files
Figma
Edit your design
JSON
Export tokens
CLI
Run npx sync-tokens
Output
All files auto-generated
$ npx sync-tokens
CLI Options
| Option | Description |
|---|---|
| --dry-run | Preview changes without writing files |
| --force | Skip confirmation prompts for breaking changes |
| --input <path> | Path to figma-tokens.json (default: ./figma-tokens.json) |
| --output <dir> | Output directory (default: ./) |
Generated Files
CSS
variables.css
light.css
dark.css
Tailwind
v3-preset.js
v4-theme.css
JavaScript
index.js
index.mjs
Types + JSON
index.d.ts
tokens.json
Breaking Change Detection
When an existing variables.css is found, sync-tokens automatically detects changes and shows a diff.
Diff view — Visualizes additions, changes, deletions, and renames with color coding
Confirmation prompt — Requires confirmation before applying breaking changes (deletions or renames)
Backward-compatible aliases — Auto-generates css/deprecated.css on rename detection — existing references won't break
--dry-run to preview the diff first, or --force to skip the confirmation prompt.
Tokens Studio Setup
Install the Tokens Studio plugin from the Figma Community
Import figma-tokens.json from your repository into the plugin
Set up GitHub sync to automatically keep design and code tokens in sync (optional)