@docx-editor.dev/react
Use the React DOCX editor, arrange packaged components, or build custom controls with hooks.
Install and mount
Install the adapter and its engine peer:
npm install @docx-editor.dev/react @docx-editor.dev/coreImport the stylesheet once and render <DocxEditor> in a container with a height:
import { DocxEditor } from '@docx-editor.dev/react';
import '@docx-editor.dev/core/styles/editor.css';
export default function App() {
return (
<div style={{ height: '100vh' }}>
<DocxEditor document="blank" />
</div>
);
}<DocxEditor> renders the title bar, menu, toolbar, navigation pane, hyperlink popover, context menu, and editable document.
Choose an API
| Task | API | Guide |
|---|---|---|
| Configure the packaged editor | <DocxEditor> props and DocxEditorRef | React props |
| Arrange or replace chrome | DocxEditor.Root, DocxEditor.Viewport, DocxEditor.Content, DocxEditor.Toolbar | React composition |
| Build custom controls | useDocxEditor, useEditorState, useEditorCommand, useEditorEvent | React hooks |
| Automate the open document | @docx-editor.dev/editor-api/browser | React examples |
| Export Markdown or PDF, and print | menu.exporters | Export, Print |
| Show tracked changes and comments | @docx-editor.dev/pro/react | Pro package |
Limits
- The adapter requires one shared copy of
@docx-editor.dev/core. - Import the stylesheet once, and give the editor's parent a measured height.
- In the Next.js App Router, load the editor with
dynamic()andssr: falsefrom a client component. The"use client"directive alone does not disable server rendering. See Next.js. - Import components, hooks, and engine helpers from the package root. The package has no
/ui,/hooks, or/dialogssubpaths. - Review comes from
@docx-editor.dev/prounder the EigenPal Pro License. PDF conversion runs on your Node.js server and also requires the EigenPal Pro License.
Next steps
- React props: Configure
<DocxEditor>and its ref. - React composition: Replace the packaged chrome.
- React API reference: Inspect all public exports.