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

React Router

Install and configure Frakment for React Router.

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

Prerequisites

  • React Router v7 (framework mode)
  • React 19
  • 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 React Router app with Frakment installed.

Create project

$ npx create-react-router@latest app
cd app

Install Tailwind v4

$ npm install tailwindcss@latest @tailwindcss/vite

Register the Vite plugin:

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

Add components

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

Use it

app/routes/home.tsx
import { Bubble, BubbleContent } from "@/components/ui/message";
 
export default function Home() {
  return (
    <Bubble>
      <BubbleContent>Hello, Frakment.</BubbleContent>
    </Bubble>
  );
}

Existing Project

Add Frakment to a React Router app you already created.

Install Tailwind v4

$ npm install tailwindcss@latest @tailwindcss/vite

Register the Vite plugin:

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

Run frakment init

$ npx frakment@latest init

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

Configure the import alias

In tsconfig.json:

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

Add a component

$ npx frakment@latest add bubble

Project structure

package.json
Vitevite.config.ts
tsconfig.json
root.tsx
app.css
home.tsx

Verify

ls app/components/ui/bubble.tsx

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

Troubleshooting

Make sure @tailwindcss/vite is in vite.config.ts and restart the dev server.

React Router v7 uses file-based routing. Make sure the route file is under app/routes/ and exported as default.

Next