LegalOSS179.4ktracked
Document Automation

docx-editor

eigenpal/docx-editor

WYSIWYG DOCX editor for React and Vue with canonical OOXML, tracked changes, collaboration, and agent-ready APIs.

Document Automationdocxdocx-editoreditorwordword-editor

DOCX Editor — .docx in, .docx out. Open source, agent ready, client-side.

npm version npm downloads license Demo Documentation

Open-source WYSIWYG .docx editor for React and Vue. Word-faithful pagination, tracked changes, comments, and lossless round-trip: untouched content and unsupported OOXML survive the save. Live demo | Documentation | Roadmap

Quick start

npm install @docx-editor.dev/react @docx-editor.dev/core   # React
npm install @docx-editor.dev/vue @docx-editor.dev/core     # Vue

See the React or Vue quick start below.

For Node.js, use ^20.16.0 || >=22.3.0. Browser applications can use the packages with their build tool.

docx-editor screenshot

Packages

Package Description Docs
@docx-editor.dev/react React editor components and hooks. Docs
@docx-editor.dev/vue Vue 3 editor components and composables. Docs
@docx-editor.dev/core DOCX parsing, editing, and rendering. Docs
@docx-editor.dev/i18n Translations and locale types. Docs
@docx-editor.dev/fonts Open-licensed substitutes for Word fonts. Docs
@docx-editor.dev/docx-to-markdown Convert DOCX to Markdown. Private preview
@docx-editor.dev/pro Tracked changes, comments, collaboration, and custom nodes. Docs
@docx-editor.dev/editor-api Office.js-compatible API for browser and server editing. Docs

@docx-editor.dev/editor-api and @docx-editor.dev/pro are licensed under the EigenPal Pro License (editor-api, pro), and you can compare and buy license and support levels on the pricing page.

If you fork an adapter, depend on @docx-editor.dev/core to receive engine fixes.

React

import { useState } from 'react';
import { DocxEditor } from '@docx-editor.dev/react';
import '@docx-editor.dev/core/styles/editor.css';

export function App() {
  const [doc, setDoc] = useState<Uint8Array>();

  return (
    <div style={{ height: '100vh', display: 'flex', flexDirection: 'column' }}>
      <input
        type="file"
        accept=".docx"
        onChange={async (e) => {
          const file = e.target.files?.[0];
          setDoc(file ? new Uint8Array(await file.arrayBuffer()) : undefined);
        }}
      />
      <div style={{ flex: 1, minHeight: 0 }}>
        {doc && <DocxEditor document={doc} mode="edit" />}
      </div>
    </div>
  );
}

Next.js / SSR: Use dynamic import. The editor requires the DOM.

Full docs: React adapter · Props and ref methods.

Vue

<script setup lang="ts">
import { ref } from 'vue';
import { DocxEditor } from '@docx-editor.dev/vue';
import '@docx-editor.dev/vue/styles.css';

const doc = ref<Uint8Array>();

async function onPick(event: Event) {
  const file = (event.target as HTMLInputElement).files?.[0];
  doc.value = file ? new Uint8Array(await file.arrayBuffer()) : undefined;
}
</script>

<template>
  <div style="height: 100vh; display: flex; flex-direction: column">
    <input type="file" accept=".docx" @change="onPick" />
    <div style="flex: 1; min-height: 0">
      <DocxEditor v-if="doc" :document="doc" mode="edit" />
    </div>
  </div>
</template>

Nuxt / SSR: Load the editor in a client-only component. The editor requires the DOM.

Full docs: Vue adapter · Props and ref methods.

Font measurement

Pass usable font bytes for Word-accurate line and page breaks. Without them, the editor uses fallback measurement that does not guarantee Word-compatible layout.

Use packagedFonts() from @docx-editor.dev/fonts for local substitutes. Add googleFonts() only when your application accepts third-party font requests.

See Fonts and measurement.

Development

bun install
bun run dev          # localhost:5173
bun run dev:markdown # Markdown demo: localhost:5177
bun run build
bun run typecheck

Try unreleased changes in the preview of main.

Examples: Vite | DOCX to Markdown | Next.js | Remix | Astro | Vue | Collaboration

Documentation | React props and ref methods | Vue props and ref methods

Contributing

Contributions welcome. See CONTRIBUTING.md for setup, tests, and the one-time CLA signature.

Translations

Locale Language
en English
de German
fr French
he Hebrew
hi Hindi
id Indonesian
pl Polish
pt-BR Portuguese (Brazil)
tr Turkish
zh-CN Chinese (Simplified)

To add a locale, see the i18n contribution guide.

bun run i18n:new de      # scaffold German locale
bun run i18n:status      # check translation coverage

License

This repository is licensed under Apache 2.0, except packages/editor-api/ and packages/pro/, which are licensed under the EigenPal Pro License (editor-api, pro); you can compare and buy license and support levels on the pricing page.

Commercial support

Tip

Questions or custom features? Email docx-editor@eigenpal.com.

Roadmap

See the public roadmap for planned work and priorities.