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

Astro

Install and configure Frakment for Astro.

Frakment works in any Astro project with the React integration, React 19, and Tailwind v4.

Prerequisites

  • Astro with the React integration
  • 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 Astro project with Frakment installed.

Create Project

$ npm create astro@latest app
cd app
npx astro add react
npx astro add tailwind

Add Components

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

Use it

src/components/Hello.tsx
import { Button } from "@/components/ui/button";
 
export default function Hello() {
  return <Button>Hello, Frakment.</Button>;
}
astro.config.mjs
---
import Hello from "@/components/Hello";
---
<Hello client:load />

Existing Project

Add Frakment to an Astro app you already created.

Add React integration

$ npx astro add react

Add Tailwind CSS

$ npx astro add tailwind

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
{
  "extends": "astro/tsconfigs/strict",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

Add a component

$ npx frakment@latest add button

Project structure

After npm create astro and astro add react, your project will have:

package.json
Astroastro.config.mjs
tsconfig.json
Astroindex.astro

Verify

After installing your first component, confirm the setup:

ls src/components/ui/button.tsx

Then render the component with client:load in an Astro 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.

React components in Astro need a client directive. Use <Hello client:load /> (or client:visible, client:idle).

Next