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

Next.js

Install and configure Frakment for Next.js.

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

Prerequisites

  • Next.js 15 or newer (App Router or Pages Router)
  • 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 Next.js app with Frakment installed.

Create Project

$ npx create-next-app@latest app --typescript --tailwind --app
cd app

Add Components

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

Use it

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

Existing Project

Add Frakment to a Next.js app you already created.

Configure Tailwind CSS

Make sure Tailwind v4 is installed and globals.css is imported in your root layout.

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": {
      "@/*": ["./*"]
    }
  }
}

Add a component

$ npx frakment@latest add bubble

Import and use

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

Project structure

After create-next-app, your project will have:

package.json
tsconfig.json
Next.jsnext.config.ts
layout.tsx
page.tsx
globals.css

Verify

After installing your first component, confirm the setup:

ls components/ui/bubble.tsx

Then import and render it in a page. 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 globals.css includes the theme tokens from Theming.

Next