Introduction
Browser-based WYSIWYG DOCX editor for React and Vue 3, with tracked changes, comments, and an Office.js-shaped automation API.
docx-editor is a WYSIWYG DOCX editor for React and Vue 3. It parses OOXML, renders paginated pages, and saves DOCX in the browser. Browser editing needs no upload or conversion service.
Install an editor
Install an adapter and the engine:
npm install @docx-editor.dev/react @docx-editor.dev/corenpm install @docx-editor.dev/vue @docx-editor.dev/coreRender the editor 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>
);
}<script setup lang="ts">
import { DocxEditor } from '@docx-editor.dev/vue';
import '@docx-editor.dev/vue/styles.css';
</script>
<template>
<div style="height: 100vh">
<DocxEditor document="blank" />
</div>
</template>To open and save files, continue with the quickstart. In server-rendered frameworks, mount the editor on the client only. See Installation.
Choose an integration
| Task | Packages | Guide |
|---|---|---|
| Edit DOCX in a React or Vue app | @docx-editor.dev/react or @docx-editor.dev/vue, plus @docx-editor.dev/core | Quickstart |
| Show tracked changes and comments | Add @docx-editor.dev/pro | Pro package |
| Edit from a server, worker, or agent | @docx-editor.dev/editor-api | Editing API |
| Automate an open browser editor | @docx-editor.dev/editor-api/browser | Editing API |
| Convert DOCX to Markdown | @docx-editor.dev/docx-to-markdown | Markdown export |
| Convert DOCX to PDF on Node.js | @docx-editor.dev/docx-to-pdf | PDF export |
The editing API follows a documented subset of the Office.js object model. It does not claim full Office.js compatibility.
Which API for which job
Use the React or Vue adapter hooks, the review hooks, and DocxEditorReview from @docx-editor.dev/pro/react or @docx-editor.dev/pro/vue to build browser review controls. Use the editing API in @docx-editor.dev/editor-api for document automation. It follows the Office.js object model and runs in browser and server hosts.
| Task | Browser controls (React or Vue) | Document automation |
|---|---|---|
| Comment on found text | editor.findMatches, editor.selectMatch, then useReview().comment | body.search, then Range.insertComment |
| Reply to a thread | useReview().reply(item, text) | Comment.reply(text) |
| Record a tracked replacement | Suggesting mode, then editor.exec({ type: 'replaceMatch', match, text }) | document.changeTrackingMode = 'TrackMineOnly', then Range.insertText(text, 'Replace') |
| Propose an AI rewrite as tracked changes | prepareRewrite through DocxEditor.createBrowser | prepareRewrite from @docx-editor.dev/editor-api/agent |
| Accept or reject a change | useReview().accept(item) or useReview().reject(item) | Revision.accept() or Revision.reject() |
| Open a change without scrolling | useReview().setActive(key, { reveal: false }) | Not applicable: no viewport |
| Highlight ranges | useHighlights(name, source, options) | Not applicable |
| Custom review rail cards | DocxEditorReview with preset set to false, useReviewCardHeights, useStackedReviewPositions, and useReviewRailMetrics | Not applicable |
| Comment-on-selection button | DocxEditorReview.AddComment as a direct child of DocxEditorReview, or useEditorCommand('review.addComment') | Not applicable |
| Page setup and paragraph dialogs | DocxEditor.PageSetupDialog or DocxEditor.ParagraphDialog | Section.pageSetup, and Paragraph properties such as alignment |
For worked examples, see Task recipes.
Check packages and licenses
| Package | Purpose | License |
|---|---|---|
@docx-editor.dev/react | React adapter and hooks | Apache 2.0 |
@docx-editor.dev/vue | Vue 3 adapter and composables | Apache 2.0 |
@docx-editor.dev/core | Framework-independent OOXML, layout, paint, and editor engine | Apache 2.0 |
@docx-editor.dev/editor-api | Browser and server automation through a documented Office.js-compatible subset | EigenPal Pro License |
@docx-editor.dev/docx-to-markdown | DOCX to Markdown conversion with pages and media | Apache 2.0 |
@docx-editor.dev/docx-to-pdf | DOCX to PDF conversion on Node.js | EigenPal Pro License |
@docx-editor.dev/pro | Tracked changes, comments, and custom nodes | EigenPal Pro License |
@docx-editor.dev/telemetry | Anonymous diagnostics, metrics, and error reporting | EigenPal Pro License |
@docx-editor.dev/i18n | Shared interface translations | Apache 2.0 |
@docx-editor.dev/fonts | Open-licensed substitutes for common DOCX default fonts | Apache-2.0 AND OFL-1.1 AND LicenseRef-GUST-Font-License |
@docx-editor.dev/fonts-cjk | Optional Chinese, Japanese, and Korean fallback font | Apache-2.0 AND OFL-1.1 |
Compare EigenPal Pro License and support options on the pricing page. The Nuxt module is a private workspace package. External Nuxt apps follow the Nuxt guide.
Find a task guide
| Task | Guide |
|---|---|
| Check feature support and round-trip behavior | DOCX fidelity |
| Change controls, colors, and dialogs | Customization |
| Connect an agent to a document | Build a DOCX agent |
| Edit right-to-left documents | Right-to-left support |
| Configure Chinese, Japanese, and Korean text | CJK text |
| Translate the interface | @docx-editor.dev/i18n |
Next steps
- Quickstart: Load, edit, and save a DOCX file.
- Installation: Check requirements and framework setup.
- Live demo: Open your own document.