For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
FrakmentFrakment

Vite

Install and configure Frakment for Vite.

Frakment works in any Vite + React 19 project with Tailwind v4. This guide covers both a new project (via the CLI) and an existing app.

Prerequisites

  • Vite with React 19 + TypeScript
  • Tailwind CSS v4 installed

Components target React 19 and Tailwind v4. For React 18, some components need forwardRef adjustments. For Tailwind v3, port the tokens from Theming manually.

Use the CLI

Scaffold a new Vite app with Frakment installed.

Create Project

$ npm create vite@latest app -- --template react-ts
cd app

Add Components

$ npx frakment@latest init
npx frakment@latest add button

Use it

src/App.tsx
import { Button } from "@/components/ui/button";
 
export default function App() {
  return <Button>Hello, Frakment.</Button>;
}

Existing Project

Add Frakment to a Vite app you already created.

Install Tailwind CSS

Follow the Tailwind v4 guide for Vite.

Run frakment init

Run npx frakment@latest init — it injects the theme block into globals.css between FRAKMENT THEME markers. Alternatively, paste the block manually from Theming:

globals.css
@import "tailwindcss";
 
/* ==== FRAKMENT THEME START ==== */
/* ... theme block ... */
/* ==== FRAKMENT THEME END ==== */

See Manual for details.

Configure the import alias in tsconfig.json

tsconfig.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}
vite.config.ts
import path from "path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
 
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: { "@": path.resolve(__dirname, "./src") },
  },
});

Add a component

$ npx frakment@latest add button

Project structure

After npm create vite, your project will have:

package.json
Vitevite.config.ts
tsconfig.json
HTML5index.html
app.tsx
main.tsx
index.css

Verify

After installing your first component, confirm the setup:

ls src/components/ui/button.tsx

Then import and render it in App.tsx. If it renders without errors, you're ready.

Troubleshooting

Run npx frakment@latest init again. It will create lib/utils.ts and update tsconfig.json.

Make sure both tsconfig.json and vite.config.ts define the @ alias. Vite needs the runtime alias, TypeScript needs the types alias.

Next