Skip to content

Astro

Create a project with React

npm create astro@latest my-app -- --add react
cd my-app

If you already have an Astro project, run npx astro add react in the project directory to add the React integration.

Configure the import alias

Map @/* to ./src/* under compilerOptions in tsconfig.json.

{
  "paths": {
    "@/*": ["./src/*"]
  }
}

Install and render the editor

npx @tiptap/cli@latest add simple-editor

Create src/pages/simple.astro. The client:only="react" directive tells Astro to mount the editor in the browser.

---
import { SimpleEditor } from '@/components/tiptap-templates/simple/simple-editor'
import '../styles/global.css'
---

<SimpleEditor client:only="react" />

Add styles

Create src/styles/global.css if your project does not have it. With the alias above, the CLI installs the shared styles in the same directory. Import both files once in the global stylesheet.

@import './_variables.scss';
@import './_keyframe-animations.scss';

Start the server with npm run dev and open /simple. If you use an existing layout that loads global styles, put the imports in its stylesheet. Style setup