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

TanStack Router

Install and configure Frakment for TanStack Router.

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

Prerequisites

  • TanStack Router 1.x
  • React 19
  • Vite 5+
  • TypeScript
  • Tailwind CSS v4

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 TanStack Router app with Frakment installed.

Create project

$ npx create-tsrouter-app@latest app --template file-router
cd app

Install Tailwind v4

$ npm install tailwindcss@latest @tailwindcss/vite

Register the Vite plugin:

vite.config.ts
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
 
export default defineConfig({
  plugins: [tanstackRouter(), react(), tailwindcss()],
});

Add components

$ npx frakment@latest init
npx frakment@latest add bubble

Use it

src/routes/index.tsx
import { createFileRoute } from "@tanstack/react-router";
import { Bubble, BubbleContent } from "@/components/ui/message";
 
export const Route = createFileRoute("/")({
  component: Index,
});
 
function Index() {
  return (
    <Bubble>
      <BubbleContent>Hello, Frakment.</BubbleContent>
    </Bubble>
  );
}

Existing Project

Add Frakment to a TanStack Router app you already created.

Install Tailwind v4

$ npm install tailwindcss@latest @tailwindcss/vite

Register the Vite plugin:

vite.config.ts
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
 
export default defineConfig({
  plugins: [tanstackRouter(), react(), tailwindcss()],
});

Run frakment init

$ npx frakment@latest init

Point to src/styles.css when prompted. The CLI injects the theme block.

Configure the import alias

In tsconfig.json:

tsconfig.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

Add a component

$ npx frakment@latest add bubble

Project structure

package.json
Vitevite.config.ts
tsconfig.json
main.tsx
styles.css
index.tsx

Verify

ls src/components/ui/bubble.tsx

Then render it in a route. If it renders without errors, you are ready.

Troubleshooting

Make sure tanstackRouter() is the first plugin in vite.config.ts. The router plugin scans src/routes/ at build time.

TanStack apps put source in src/. Set "@/*": ["./src/*"] in tsconfig.json and "components": "@/components" in components.json.

Next