Next.js example

This App Router example loads the React editor in the browser.

Run the example

From the repository root, build the workspace packages before you start Next.js:

bun install
bun run build:packages
bun run dev:nextjs

Open http://localhost:3000.

Set the client boundary

app/page.tsx is a Client Component. It uses dynamic() with ssr: false:

'use client';

import dynamic from 'next/dynamic';

const Editor = dynamic(() => import('./components/Editor').then((m) => m.Editor), {
  ssr: false,
  loading: () => <div>Loading editor...</div>,
});

export default function Page() {
  return <Editor />;
}

Next.js requires the dynamic() call inside a Client Component. app/components/Editor.tsx also uses 'use client' and renders <DocxEditor />.

Add the editor to Next.js

npm install @docx-editor.dev/react @docx-editor.dev/core

Import @docx-editor.dev/core/styles/editor.css once. Load your editor component with dynamic(..., { ssr: false }).

For more information, see the React adapter 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.