Navigated to /docs/ui-core/installation

Install UI Core for tooling

Install the platform-neutral theme engine, export a deterministic token artifact, and fail CI when theme validation reports problems.

Start at the correct package boundary

Install UI Core directly only when you are building a token exporter, design-tool integration, custom renderer, or another Node-based pipeline. A normal Tavo.js website should install @tavojs/ui and use its plugin and bundled tavo-ui command instead.

BASH
bashnpm install --save-dev @tavojs/ui-core

Create a deterministic token exporter

JS
jsimport { mkdir, writeFile } from "node:fs/promises";
import { buildThemeTokens } from "@tavojs/ui-core";

const theme = buildThemeTokens({
  color: {
    light: {
      primary: "#116a67",
      secondary: "#d86c3d",
    },
  },
  accessibility: {
    contrast: "AA",
    failOnViolation: false,
  },
});

const artifact = {
  schemaVersion: 1,
  breakpoints: theme.breakpoints,
  modes: {
    light: {
      ...theme.staticTokens,
      ...theme.modes.light.tokens,
    },
    dark: {
      ...theme.staticTokens,
      ...theme.modes.dark.tokens,
    },
  },
  warnings: theme.warnings,
};

await mkdir("dist", { recursive: true });
await writeFile(
  "dist/design-tokens.json",
  `${JSON.stringify(artifact, null, 2)}
`,
);

if (theme.warnings.length > 0) {
  console.error(theme.warnings.join("
"));
  process.exitCode = 1;
}
JSON
json{
  "scripts": {
    "tokens:export": "node scripts/export-tokens.mjs"
  }
}

Run it and inspect the output contract

BASH
bashnpm run tokens:export
node --check scripts/export-tokens.mjs

A successful run creates dist/design-tokens.json with schemaVersion, breakpoints, light and dark token maps, and a warnings array. The command exits nonzero when contrast warnings exist, so the same script is a CI validation step.