The React DOCX Editor is an experimental document editing surface built on top of @extend-ai/react-docx. It keeps the viewer shell familiar while enabling direct Word document mutations through the package editor API.
Installation
pnpm dlx shadcn@latest add @extend/docx-editor
Useful behaviors
- Toolbar controls cover import, export, undo, redo, zoom, theme, read-only mode, tracked changes, text styles, color, highlight, links, alignment, lists, borders, images, and tables.
- Page thumbnails stay in the left rail and scroll the editor viewport to the selected page.
- The editor uses
useDocxEditorandDocxEditorViewer, so mutations flow through the publicreact-docxcontroller API. - Uploaded files replace the current document while URL-loaded DOCX files are fetched from the provided
src.
API Reference
DocxEditorPreview
The DocxEditorPreview component renders an editable DOCX file with upload, toolbar, thumbnails, zoom, and export controls.
| Prop | Type | Default | Required |
|---|---|---|---|
className | string | - | No |
defaultIsDark | boolean | false | No |
fileName | string | - | No |
isDark | boolean | - | No |
onIsDarkChange | (isDark: boolean) => void | - | No |
rounded | boolean | false | No |
src | string | - | No |