Overview
Customize your DOCX editor with CSS themes, React and Vue controls, document styles, comments, and tracked changes.
Customize your DOCX editor to fit your application. Start with the contract example, then choose a customization area. Each guide includes a live preview, supported options, and React and Vue reference code.
Design principles
The DOCX editor separates document editing from interface controls. React components use the same editor state and commands as the packaged editor.
Start with the smallest change that fits your application:
- Appearance: Set
--doc-*CSS properties on.docx-editor. UseclassNameanddata-activeto style supported controls. - Composition: Use
DocxEditor.Root,.Toolbar,.Viewport, and.Contentto arrange the interface. Keep controls insideRoot. - Individual controls: Use named parts such as
DocxEditor.Toolbar.Bold. Replace an icon withicon, or supply your own element throughasChildwhere supported. - Control sets: Override a toolbar slot in place, use
hiddento remove it, or setpreset={false}to compose the toolbar. - Custom behavior: Use
useEditorCommand(slotId)for command state and execution. UseuseEditorState(selector)for the state your control displays.
Preserve the document selection when you build custom controls. Keep labels, keyboard support, and disabled states accessible. The area guides identify supported parts and show complete examples.
Interface styling changes editor controls. Document styles and fonts change document content and can change pagination.
For the React component API, see Composition and Hooks.
Customization guides
Interface
Appearance
Set interface colors, spacing, borders, and dark mode.
Layout
Place the toolbar, document, and application panels.
Toolbar
Choose controls, replace icons, and connect your own buttons.
Menus
Choose file menu and context menu actions.
Dialogs
Replace dialog parts and keep validation, focus, and draft state.
Review
Tracked changes
Choose the review sidebar or tracked change balloons. Set colors, marks, and review controls.
Comments and review cards
Style comments, change cards, markers, and review actions.
Document
Document styles
Define headings, paragraphs, and tables in your DOCX template.
Fonts
Load font bytes and choose your font controls.
Language and locale
Set editor labels and regional formatting independently.
Choose the API level
| Level | Use |
|---|---|
| Props and CSS tokens | Change labels, colors, fonts, and viewer preferences. |
| Named parts | Arrange controls and replace selected elements. |
| Hooks and composables | Connect application controls to editor state and commands. |
| Modules | Add review, collaboration, or custom document nodes. |
Review controls require an EigenPal Pro License. Toolbar, layout, fonts, and labels also work without the review module. For package setup, see Installation. These examples use application arrangements, not packaged visual presets.
For document extensions, see Custom nodes. For shared editing, see Collaboration.
React and Vue reference
Pass your DOCX bytes and loaded fonts to this component. The preview uses a fictional contract.
import { DocxEditor, type DocxEditorRootProps } from '@docx-editor.dev/react';
import { reviewModule, DocxEditorReview } from '@docx-editor.dev/pro/react';
import '@docx-editor.dev/core/styles/editor.css';
const modules = [reviewModule()];
export function ContractEditor({
bytes,
fonts,
}: {
bytes: Uint8Array;
fonts: DocxEditorRootProps['fonts'];
}) {
return (
<div className="docx-editor contract-workspace">
<DocxEditor.Root
document={bytes}
fonts={fonts}
modules={modules}
author="Demo reviewer"
mode="suggesting"
reviewDisplayMode="all-markup"
>
<DocxEditor.Toolbar preset={false}>
<DocxEditor.Toolbar.Undo />
<DocxEditor.Toolbar.Redo />
<DocxEditor.Toolbar.Bold />
<DocxEditor.Toolbar.Italic />
<DocxEditor.Toolbar.EditingMode />
</DocxEditor.Toolbar>
<DocxEditor.Viewport style={{ height: 520 }}>
<DocxEditor.Content />
<DocxEditor.HyperLink />
<DocxEditor.ContextMenu />
<DocxEditorReview />
</DocxEditor.Viewport>
</DocxEditor.Root>
</div>
);
}<script setup lang="ts">
import { DocxEditor } from '@docx-editor.dev/vue';
import { reviewModule, DocxEditorReview } from '@docx-editor.dev/pro/vue';
import type { FontConfigurationFragment } from '@docx-editor.dev/vue';
import '@docx-editor.dev/core/styles/editor.css';
defineProps<{ bytes: Uint8Array; fonts: FontConfigurationFragment }>();
const modules = [reviewModule()];
</script>
<template>
<div class="docx-editor contract-workspace">
<DocxEditor.Root
:document="bytes"
:fonts="fonts"
:modules="modules"
author="Demo reviewer"
mode="suggesting"
review-display-mode="all-markup"
>
<DocxEditor.Toolbar :preset="false">
<DocxEditor.Toolbar.Undo />
<DocxEditor.Toolbar.Redo />
<DocxEditor.Toolbar.Bold />
<DocxEditor.Toolbar.Italic />
<DocxEditor.Toolbar.EditingMode />
</DocxEditor.Toolbar>
<DocxEditor.Viewport :style="{ height: '520px' }">
<DocxEditor.Content />
<DocxEditor.HyperLink />
<DocxEditor.ContextMenu />
<DocxEditorReview />
</DocxEditor.Viewport>
</DocxEditor.Root>
</div>
</template>More control
See Composition for supported parts, types, and additional examples.