Astro example

This example loads the React editor as an Astro island.

Run the example

From the repository root, build the workspace packages before you start Astro:

bun install
bun run build:packages
bun run dev:astro

Open http://localhost:4321.

Create the island

Use client:only="react" because the editor measures layout in the browser:

---
import { Editor } from '../components/Editor';
---
<Editor client:only="react" />

client:load still renders the component on the server. That behavior fails when the editor accesses window.

Add the editor to Astro

npm install @docx-editor.dev/react @docx-editor.dev/core
npx astro add react

Import @docx-editor.dev/core/styles/editor.css once. Mount the editor with client:only="react".

For more information, see the Astro integration guide.

Next steps

This page renders the example’s README from eigenpal/docx-editor at release v2.21.0. Read it in the repository for the version you have checked out.

.docx in. .docx out.

Open a real document in the editor, then wire it into your app. It all runs client-side.