@docx-editor.dev/pro/react
@docx-editor.dev/pro/react — React chrome for the review rail and custom nodes.
Compound components over the pro modules: arrange the parts you want rather than accepting one fixed layout. Requires the matching module to be registered on the editor — without it there is nothing to derive cards or chips from.
Functions (19)
activatedCustomNodeOffunctionSource ↗
The activation every host hook receives: identity, POST-fromDocx attrs, and — when the review module derived a card for the node — its literal text and canonical node id.
One enrichment step for every surface (click, hover, edit, context-menu card), so a hook written against the review rail's attrs shape sees the SAME shape from the chip. Without a review module the definition's fromDocx runs over the raw decode with text: ''; its veto (null) drops the activation, exactly as recognition would have.
declare function activatedCustomNodeOf(resolved: ResolvedCustomNodeActivation, editor: Editor | null | undefined): ActivatedCustomNode | null;collaborationModulefunctionSource ↗
Build the collaboration module. Construction never validates the key and never touches the network.
declare function collaborationModule(options: CollaborationModuleOptions): EditorModule;CustomNodeChromefunctionSource ↗
Paints custom-node chips and dispatches pointer activation on them.
Renders nothing itself — it installs the chip styles and the activation listeners, so mount it once anywhere inside the editor provider. Chip colours come from each definition's chrome, which is host-authored and never file data.
declare function CustomNodeChrome(props: CustomNodeChromeProps): null;```tsx
<DocxEditor.Root>
<CustomNodeChrome onNodeClick={(node) => setPopover(node)} />
<DocxEditor.Viewport><DocxEditor.Content /></DocxEditor.Viewport>
</DocxEditor.Root>
```CustomNodeContextMenufunctionSource ↗
Renders the pointed-at node's card data plus its "Edit label" row, or nothing when the right-click landed elsewhere. Carries docxRowPlacement: 'start', so the context menu mounts it above the packaged rows.
declare function CustomNodeContextMenu(props: CustomNodeContextMenuProps): react.JSX.Element | null;DocxEditorCollaborationRootfunctionSource ↗
A DocxEditor.Root wired to a collaboration room.
```tsx const collaboration = useHocuspocusCollaboration({ modules: MODULES, room });
<DocxEditorCollaborationRoot collaboration={collaboration} fallback={<p>Connecting…</p>}> <DocxEditor.Toolbar /> <DocxEditor.Viewport> <DocxEditor.Content /> <DocxEditorCollaboration.CaretLabels /> </DocxEditor.Viewport> </DocxEditorCollaborationRoot> ```
The presence parts take no session: they read it from the editor this mounts.
declare function DocxEditorCollaborationRoot(input: DocxEditorCollaborationRootProps): react.JSX.Element;resolveCustomNodeActivationfunctionSource ↗
The recognized custom node a pointer target sits on, or null.
Walks up from target to the painted control boundary, reads its data-tag, and matches the decoded identity against nodes. Returns null for anything that is not a recognized chip — ordinary text, an unclaimed SDT, a tag no definition owns.
Every input is DOM the engine painted from FILE DATA. The tag is attacker-controlled and goes through the codec's guards; it never reaches markup.
declare function resolveCustomNodeActivation(target: EventTarget | null, nodes: readonly AnyCustomNodeDefinition[]): ResolvedCustomNodeActivation | null;reviewModulefunctionSource ↗
Build the review module. Construction never validates the key and never touches the network. It installs the drawing renderers process-wide, so charts, SmartArt layout, drawing effects, WordArt, and metafile pictures render without a separate drawingModule().
declare function reviewModule(options?: ReviewModuleOptions): EditorModule;useCollaborationParticipantsfunctionSource ↗
Reactive participant roster for the collaboration session.
Omit session and it reads the one the editor above holds. Returns the same array reference until the roster actually changes, so a memoized consumer does not re-render on unrelated awareness traffic. No session yields a stable empty array.
declare function useCollaborationParticipants(session?: CollaborationSession | null): readonly CollaborationParticipant[];useCollaborationSessionfunctionSource ↗
The live collaboration session of the editor above this component, or null.
The editor already holds the session a collaborationModule contributed, so presence chrome reads it from here instead of being handed it: every part and hook in this package takes session as an OPTIONAL prop and falls back to this. A host that has one Root and one room never passes it at all.
Pass it explicitly when a component sits outside the Root that owns the room, or when one page renders two.
declare function useCollaborationSession(): CollaborationSession | null;useCollaborationStatusfunctionSource ↗
Reactive status for the collaboration session, with live and diverged derived.
Omit session and it reads the one the editor above holds. Pass it explicitly for a session this Root does not own.
declare function useCollaborationStatus(session?: CollaborationSession | null): UseCollaborationStatusReturn;useCustomNodeDefinitionsfunctionSource ↗
The definitions a chrome surface should act on: the nodes prop when given, else the definitions registered on the editor (customNodesModule). Registering once and letting every surface default to it is the intended shape; the prop exists for a host that wants one surface scoped narrower.
declare function useCustomNodeDefinitions(nodes: readonly AnyCustomNodeDefinition[] | undefined): readonly AnyCustomNodeDefinition[];useDocumentCollaborationfunctionSource ↗
Own a provider-agnostic collaboration session for a React host.
The consumer creates the ydoc, the awareness, and whatever provider replicates them (WebSocket, WebRTC, offline persistence); this hook owns only the document session over them, with the same StrictMode-safe lifecycle as useWebrtcCollaboration. It imports no network provider.
declare function useDocumentCollaboration(options?: UseDocumentCollaborationOptions): UseDocumentCollaborationReturn;useReviewfunctionSource ↗
Read the review queue and act on it.
Subscribes to the editor's own change stream, so the list re-derives when the document does and not on every render.
This is the browser review API: comment, reply, accept, reject, and open items from your own UI. For headless, server, or agent pipelines, use @docx-editor.dev/editor-api instead.
declare function useReview(query?: ReviewItemQuery): UseReviewReturn;useReviewAuthorfunctionSource ↗
The resolved presentation of one author — colour, ramp slot, and any declared style — or undefined when no argument is given, or when the author is in neither the document's roster nor the review queue.
COMMENT AUTHORS INCLUDED. The document's revision roster does not carry someone who only left comments, so this resolves their declaration directly; their card draws in the colour the host declared, exactly as a reviewer's does.
The link between a CUSTOM card and the author styling system: a List render callback or card child reads the item's author here and draws with the same colours the painted document and the packaged cards use. Live: a setRevisionStyles call re-renders the rail, and this answer with it. Outside the rail it reads the editor's author roster.
tsx
function MyCard({ item }: { item: ReviewItemView }) {
const author = useReviewAuthor(item.author);
return <div style={{ borderColor: author?.color }}>…</div>;
}
<DocxEditorReview.List>{(item) => <MyCard item={item} />}</DocxEditorReview.List>;
declare function useReviewAuthor(author: string | undefined): ReviewAuthorInfo | undefined;useReviewItemfunctionSource ↗
The review item the surrounding card (or balloon) renders, or null outside one.
The hook a host's own card content is built from: children passed into the rail's cards — extra actions, a custom body — read the CURRENT item here rather than receiving props, exactly the way the packaged parts do.
declare function useReviewItem(): ReviewItemView | null;useReviewOffunctionSource ↗
The same hook against an explicit editor, for hosts that hold their own.
declare function useReviewOf(editor: Editor | null, query?: ReviewItemQuery): UseReviewReturn;useReviewRailMetricsfunctionSource ↗
The review column's geometry in CSS pixels: what converts review anchors and stacked positions, which are layout points from the top of the first page, into a card's top.
Call it without arguments inside DocxEditorReview, for example in children of <DocxEditorReview preset={false}>, to read the packaged rail's own measurement. Those children render inside the rail element, which already sits at left.
Pass railRef to measure your own column instead. Attach the ref to an element that the calling component renders, give it position: absolute, and render it directly inside DocxEditor.Viewport with no positioned element in between: its offset parent must be the scroll container that holds the pages. Development builds warn once when it is not. The column reserves the review gutter unless reserveGutter is false.
While useReview().paneOpen is false the viewport reserves only a marker strip, so render no cards then. compact is true when the pane is open but too narrow for a column.
The value updates when the zoom, the window size, the page count, the document load, content above the pages, or the reserved review gutter changes. It works in a pop-out window or an iframe, because it observes the element's own window.
declare function useReviewRailMetrics(railRef?: RefObject<HTMLElement | null> | null, options?: UseReviewRailMetricsOptions): ReviewRailMetrics;Position custom cards
```tsx
function MyColumn({ heights }: { heights: ReadonlyMap<string, number> }) {
const railRef = useRef<HTMLDivElement>(null);
const metrics = useReviewRailMetrics(railRef);
const { items } = useReview();
const positions = useStackedReviewPositions(items, heights, { scale: metrics.scale });
return (
<div
ref={railRef}
style={{
position: 'absolute',
top: 0,
left: metrics.left ?? 0,
// The column's width places it when `metrics.side` is 'left'.
width: 300,
visibility: metrics.left === null ? 'hidden' : 'visible',
}}
>
{items.map((item) => (
<MyCard
key={item.key}
item={item}
style={{
position: 'absolute',
top: metrics.top + (positions.get(item.key) ?? 0) * metrics.scale,
}}
/>
))}
</div>
);
}
```useReviewRefusalMessagefunctionSource ↗
The packaged sentence for a refused review write, in the reader's language, for a host's own card or balloon. It honors the review pane's t overrides, as the packaged cards do.
declare function useReviewRefusalMessage(): (refusal: ReviewWriteRefusal) => string;```tsx
const { lastRefusal } = useReview();
const refusalMessage = useReviewRefusalMessage();
return lastRefusal?.key === item.key ? <p role="alert">{refusalMessage(lastRefusal)}</p> : null;
```useStackedReviewPositionsfunctionSource ↗
Non-overlapping Y positions for cards you have measured.
Separate from useReview because only the CALLER knows how tall its cards are — a host rendering its own markup can be told where each anchor is, but not how much room its card needs. Pass the measured heights back and get positions that do not collide; skip it entirely and cards sit on their raw anchors, which is correct for a rail that does not stack.
Takes anything with a key and an anchor, not only cards: a compose box competes for the same column and has to be stacked WITH them or it lands on top of the card whose text was just re-selected. Entries must arrive in document order.
An entry with isActive: true, as a review placement has while its card is open, stays at its own anchor. The entries before it move up to make room, so Next Change never leaves the open card below the visible rail. Pass placements through as they are to keep this.
UNITS. Anchors are in layout POINTS, because that is what the engine publishes; measured heights are in CSS PIXELS, because that is what the DOM reports. Pass scale so the two can be added. Without it a 330px card advanced the run by 330 POINTS — 440px — and two comments on adjacent lines of one paragraph sat a third of a page apart.
Returns each card's top in layout points. useReviewRailMetrics supplies scale and the pixel offset of the first page: a card's CSS top is metrics.top + position * metrics.scale.
declare function useStackedReviewPositions(items: readonly {
readonly key: string;
readonly anchorY: number | null;
readonly isActive?: boolean;
}[], heights: ReadonlyMap<string, number>, options?: {
readonly gap?: number;
readonly scale?: number;
readonly defaultHeight?: number;
}): ReadonlyMap<string, number>;Interfaces (44)
CollaborationAvatarPropsinterfaceSource ↗
Props for [DocxEditorCollaboration](DocxEditorCollaboration).Avatar.
interface CollaborationAvatarProps| Member | Type | Summary |
|---|---|---|
| children? | ReactNode | Replaces the initials inside the disc; the accent background stays. |
| className? | string | Classes added to the part's root element. |
| participant | CollaborationParticipant | The participant to show. |
CollaborationAvatarRenderPropsinterfaceSource ↗
Render props for [DocxEditorCollaboration](DocxEditorCollaboration).Avatars' per-participant override.
interface CollaborationAvatarRenderProps| Member | Type | Summary |
|---|---|---|
| avatarUrl? | string | The image declared for this participant with `DocxEditor.AuthorStyle`, or `undefined`. |
| color | string | The resolved accent — published colour, or the review roster's colour for the name. |
| initials | string | The first letter of up to two name words, uppercased. |
| participant | CollaborationParticipant | The participant this avatar shows. |
CollaborationAvatarsPropsinterfaceSource ↗
Props for [DocxEditorCollaboration](DocxEditorCollaboration).Avatars.
interface CollaborationAvatarsProps| Member | Type | Summary |
|---|---|---|
| children? | (props: CollaborationAvatarRenderProps) => ReactNode | Renders one participant's avatar in place of the packaged disc. |
| className? | string | Classes added to the part's root element. |
| max? | number | Avatars shown before the rest collapse into one "+N" chip. Omit to show everyone. |
| session? | CollaborationSession | null | The session whose participants the stack shows. Omit it and the part uses the one the editor above holds; `null` renders nothing. |
CollaborationCaretLabelRenderPropsinterfaceSource ↗
What a custom remote-caret label renders with.
The renderer mounts inside the adapter's provider tree, so every hook works in it — useDocxEditor, useEditorState, the review hooks. It has the opened document, not only the collaborator.
interface CollaborationCaretLabelRenderProps| Member | Type | Summary |
|---|---|---|
| avatarUrl? | string | The image declared for this collaborator with `DocxEditor.AuthorStyle`, or `undefined`. |
| color | string | The resolved accent: the published colour when the engine can paint it, otherwise the review roster's colour for the name — the same resolution the painted label uses. |
| participant | CollaborationParticipant | null | The session roster entry for the selection's actor, or null while presence catches up. |
| selection | CollaborationRemoteSelection | The remote selection this label marks, resolved into this replica's addresses. |
CollaborationCaretLabelsPropsinterfaceSource ↗
Props for [DocxEditorCollaboration](DocxEditorCollaboration).CaretLabels.
The rendered content lands in the engine's label layer, which is furniture: the layer is aria-hidden and takes no pointer events. Assistive technology does not read a label, and nothing inside one is clickable or focusable. Keep interactive or announced presence UI in your own chrome, such as the avatar stack.
interface CollaborationCaretLabelsProps| Member | Type | Summary |
|---|---|---|
| children? | (props: CollaborationCaretLabelRenderProps) => ReactNode | Renders one label's content. Without it the label shows the collaborator's name, matching the engine default, so mounting the part bare changes nothing visible. |
| session? | CollaborationSession | null | The session whose collaborators label the carets. Omit it and the part uses the one the editor above holds; `null` renders nothing. |
CollaborationFailureinterface
One collaboration failure: a typed code plus optional free-form detail.
interface CollaborationFailure| Member | Type | Summary |
|---|---|---|
| code | CollaborationFailureCode | Stable code for application logic. |
| detail? | string | Bounded diagnostic text for logs. Not a parsing contract. |
CollaborationIdentityinterface
Human or automation identity attached to authored collaboration transactions.
interface CollaborationIdentity| Member | Type | Summary |
|---|---|---|
| actorId | string | Stable author id, 1 to 256 characters after trimming. Recorded on authored changes. |
| color? | string | Presence color, at most 64 characters. An unsafe CSS color falls back to the accent. |
| name | string | Display name, 1 to 256 characters after trimming. |
| role? | 'human' | 'agent' | `agent` for automation. Defaults to `human`. |
CollaborationIdentityUpdateinterfaceSource ↗
Display-identity fields a live session can update.
actorId and role are attribution and stay immutable for the session lifetime, so this type cannot name them.
interface CollaborationIdentityUpdate| Member | Type | Summary |
|---|---|---|
| color? | string | New presence color, at most 64 characters. |
| name? | string | New display name, 1 to 256 characters after trimming. |
CollaborationModuleOptionsinterfaceSource ↗
How [collaborationModule](collaborationModule) is configured. The session is required; the licence key is optional and never validated.
interface CollaborationModuleOptions extends ProLicenseOptions| Member | Type | Summary |
|---|---|---|
| session | EditorCollaborationSession | The session from a collaboration factory. The editor attaches its document port to it. |
CollaborationParticipantinterface
One validated identity visible through ephemeral collaboration presence.
interface CollaborationParticipant extends CollaborationIdentity| Member | Type | Summary |
|---|---|---|
| isLocal | boolean | True for this replica's own participant. |
CollaborationRemoteSelectioninterface
Stable remote selection resolved into this replica's canonical paragraph addresses.
Anchor and head may name different paragraphs. A collapsed caret is the same address twice.
interface CollaborationRemoteSelection| Member | Type | Summary |
|---|---|---|
| actorId | string | The participant's `actorId`. |
| anchor | CollaborationRemoteSelectionAddress | Where the selection starts. |
| color? | string | The participant's presence color, when it published a safe one. |
| head | CollaborationRemoteSelectionAddress | Where the selection ends: the remote caret. |
| kind? | CollaborationSelectionKind | `cells` for a table cell rectangle; absent for a character range. |
| name | string | The participant's display name. |
CollaborationRemoteSelectionAddressinterface
One endpoint of a remote selection resolved into this replica's canonical addresses.
paragraphId is the stable w14:paraId. nodeId is replica-local and is used to paint.
interface CollaborationRemoteSelectionAddress| Member | Type | Summary |
|---|---|---|
| nodeId | string | The paragraph's node id in this replica's editor tree. |
| offset | number | A UTF-16 offset in the paragraph's text. |
| paragraphId | string | The stable `w14:paraId` of the paragraph. |
CollaborationRootSourceinterfaceSource ↗
What this component needs from a room, which every collaboration hook already returns.
Structural on purpose: useHocuspocusCollaboration, useWebrtcCollaboration and useDocumentCollaboration all satisfy it, and so does a host that owns its own resources.
interface CollaborationRootSource| Member | Type | Summary |
|---|---|---|
| document | Uint8Array | null | The document bytes to mount, or null while none is ready. |
| modules | readonly EditorModule[] | The editor modules to register, the collaboration module among them. |
| session | CollaborationSession | null | The collaboration session, or null while none is connected. |
CollaborationSessioninterfaceSource ↗
Host-facing collaboration session.
A host reads identity, status, presence, and undo. The editor attaches [EditorCollaborationSession](EditorCollaborationSession) internally and never through this type.
interface CollaborationSession| Member | Type | Summary |
|---|---|---|
| canRedo | | Whether the shared undo history holds a local step to redo. |
| canUndo | | Whether the shared undo history holds a local step to undo. |
| documentId | string | The room's document id. |
| identity | CollaborationIdentity | The validated local identity. |
| offlineEditing? | boolean | Whether edits continue while the transport is down (`disconnected`). Set by the `offlineEditing` option; absent means true. |
| participants | | Participants in presence, this replica included. Capped at 256. |
| redo | | Redo this participant's last undone step. Returns false when refused. |
| remoteSelections | | Other participants' selections, resolved into this replica's addresses. |
| sessionId | string | Unique identity for this attachment lifetime. |
| setIdentity | | Update the display name and color mid-session, when the replica supports it. |
| status | | Current lifecycle state. |
| statusSnapshot | | Cached status, current reason, and last failure. |
| subscribeParticipants | | Call `listener` when the participant list changes. Returns the unsubscribe function. |
| subscribeRemoteSelections | | Call `listener` when a remote selection changes. Returns the unsubscribe function. |
| subscribeStatus | | Call `listener` on each status or reason change. Returns the unsubscribe function. |
| undo | | Undo this participant's last step; others' edits stay. Returns false when refused. |
CollaborationStatusNoticePropsinterfaceSource ↗
Props for [DocxEditorCollaboration](DocxEditorCollaboration).Status.
interface CollaborationStatusNoticeProps| Member | Type | Summary |
|---|---|---|
| children? | (props: CollaborationStatusNoticeRenderProps) => ReactNode | Renders the notice in place of the packaged one. |
| className? | string | Classes added to the notice region. |
| onRejoin? | () => void | Called from the part's "Rejoin" button when this copy is out of sync, or when edits have waited too long for the room. Save the editor and pass the bytes to your provider hook's `rejoin`. Without it the part shows the message only. |
| session? | CollaborationSession | null | The session to report on. Omit it and the part uses the one the editor above holds; `null` renders nothing. |
CollaborationStatusNoticeRenderPropsinterfaceSource ↗
What a custom [DocxEditorCollaboration](DocxEditorCollaboration).Status renders with.
interface CollaborationStatusNoticeRenderProps| Member | Type | Summary |
|---|---|---|
| kind | CollaborationNoticeKind | Which notice to show. |
| message | string | The packaged message for `kind`, in the editor's language. |
| rejoin? | () => void | Calls `onRejoin`; present for `outOfSync` and `stalled` when the part has one. |
CollaborationStatusSnapshotinterface
Cached status read. Same reference until one of its fields changes.
interface CollaborationStatusSnapshot| Member | Type | Summary |
|---|---|---|
| failureCount? | number | How many failures this session has recorded. It changes with each new failure, also when its code and detail repeat the last one, as a refused edit refused again does. Absent from a session that does not count. |
| lastFailure | CollaborationFailure | undefined | The most recent `error` reason. Kept after the replica recovers. |
| reason | CollaborationFailure | undefined | Why the replica holds `status`, or `undefined` when nothing is wrong. |
| recovering? | boolean | The session is in `error` but heals by itself: it realigns on the next clean update and returns to its previous status. A host shows a passing notice, not a rejoin action. Absent means false. |
| status | CollaborationStatus | Current lifecycle state. |
| waiting? | boolean | Edits wait: the room sent an update that depends on one still on its way, and an edit made now could touch the text it changes. The editor refuses edits meanwhile, with `collaboration-session-not-ready`, and accepts them again when the update arrives or the wait times out. Absent means false. |
CreateDocumentCollaborationOptionsinterfaceSource ↗
Options for one full-document collaboration replica.
The caller owns ydoc.
interface CreateDocumentCollaborationOptions| Member | Type | Summary |
|---|---|---|
| awareness | Awareness | Presence channel for participants and remote selections, from `y-protocols/awareness`. |
| bootstrap | CollaborationBootstrap | Whether to seed the room, join it, or let the peers decide. |
| documentId | string | The room's document id, 1 to 256 characters. A room seeded with another id refuses. |
| identity | CollaborationIdentity | The local participant. Recorded as the author of this replica's changes. |
| offlineEditing? | boolean | Admit local edits while the transport is `disconnected`. |
| sessionId? | string | Unique attachment identity. Omit it to generate a new identity for this session. |
| ydoc | Y.Doc | The room's Yjs document. Connect its provider before a `join` bootstrap. |
CustomNodeChromePropsinterfaceSource ↗
Props for [CustomNodeChrome](CustomNodeChrome): which definitions to paint, and where activation goes.
The two hooks are the component-level twins of a definition's own onClick/onHover. Host UI state belongs here rather than on the definition, which every surface shares and which has no React context to close over.
interface CustomNodeChromeProps| Member | Type | Summary |
|---|---|---|
| nodes? | readonly CustomNodeDefinition[] | Definitions to style and dispatch on. Defaults to the ones registered on the editor. |
| onNodeClick? | (node: ActivatedCustomNode) => void | Component-level activation hook — where host UI state (popovers) belongs. |
| onNodeHover? | (node: ActivatedCustomNode) => void |
CustomNodeContextMenuPropsinterfaceSource ↗
Props for [CustomNodeContextMenu](CustomNodeContextMenu): which definitions get menu sections, and which rows those sections offer.
The Edit row renders when either the definition's own onEdit or this component's onEditNode is present; the Remove row is on by default but only where the node's canonical id can be resolved.
interface CustomNodeContextMenuProps| Member | Type | Summary |
|---|---|---|
| nodes? | readonly CustomNodeDefinition[] | Definitions to offer sections for. Defaults to the ones registered on the editor. |
| onEditNode? | (node: ActivatedCustomNode, definition: CustomNodeDefinition) => void | Component-level edit hook — where host UI state (an edit dialog) belongs, the twin of `CustomNodeChrome`'s `onNodeClick`. Runs after the definition's own `onEdit`. The row renders when EITHER hook is present. |
| onRemoveRefused? | (node: ActivatedCustomNode, reason: string) => void | Called when Remove was refused, with the engine's own reason. |
| remove? | boolean | The "Remove label" row, on by default: it deletes the node — wrapper and label, one undo step — via `removeCustomNode`. Rendered only when the node's id is resolvable (a registered review module resolves it). `false` removes the row. |
DocxEditorCollaborationNamespaceinterfaceSource ↗
The collaboration presence compound.
interface DocxEditorCollaborationNamespace| Member | Type | Summary |
|---|---|---|
| Avatar | typeof CollaborationAvatar | One participant's avatar, for hosts arranging their own presence chrome. |
| Avatars | typeof CollaborationAvatars | The packaged avatar stack, coloured to match the review module's author colours. |
| CaretLabels | typeof CollaborationCaretLabels | Host-rendered remote-caret labels, with full adapter context inside each label. |
| Status | typeof CollaborationStatusNotice | The room's state in one line, shown only when the user needs to know. |
DocxEditorCollaborationRootPropsinterfaceSource ↗
Props for [DocxEditorCollaborationRoot](DocxEditorCollaborationRoot).
Everything DocxEditor.Root takes except the three this component owns.
interface DocxEditorCollaborationRootProps extends Omit<DocxEditorRootProps, 'document' | 'modules'>| Member | Type | Summary |
|---|---|---|
| collaboration | CollaborationRootSource | The room, straight from a collaboration hook. |
| fallback? | ReactNode | What to render before the room has a document — while connecting, or after a failure. |
DocxEditorReviewNamespaceinterfaceSource ↗
The review rail compound.
interface DocxEditorReviewNamespace| Member | Type | Summary |
|---|---|---|
| (member-0) | | |
| Accept | typeof ReviewAccept | |
| AddComment | typeof ReviewAddComment | The "comment on this" button beside a selected range. A root part: put it as a direct child of `DocxEditorReview` so the rail positions it. |
| Author | typeof ReviewAuthor | |
| Avatar | typeof ReviewAvatar | |
| Balloon | typeof ReviewBalloon | The decision balloon opened by clicking a tracked change in the page: format and structural changes always, every change under `revisionsIn: 'balloons'`. |
| Card | typeof ReviewCard | |
| Delete | typeof ReviewDelete | Discard the card: delete a comment thread, or reject a tracked change. |
| Draft | typeof ReviewDraft | The compose box a new comment is written in. It renders only while a draft is open. Pass `top` when you render your own cards; without it, the box uses the packaged card stack. |
| Empty | typeof ReviewEmpty | |
| List | typeof ReviewList | |
| Markers | typeof ReviewMarkers | The collapsed rail: one marker per item, shown when the pane is closed. |
| Refusal | typeof ReviewRefusal | Why the card's last action was refused, when it was. Absent otherwise. |
| Reject | typeof ReviewReject | |
| Reopen | typeof ReviewReopen | |
| Replies | typeof ReviewReplies | |
| Reply | typeof ReviewReply | |
| Resolve | typeof ReviewResolve | |
| Summary | typeof ReviewSummary | |
| Time | typeof ReviewTime |
ProLicenseOptionsinterfaceSource ↗
Accepted by every pro entry point.
interface ProLicenseOptions| Member | Type | Summary |
|---|---|---|
| licenseKey? | string | Your license key from docx-editor.dev. Optional in v1: unlicensed use in development and evaluation is permitted, production use requires a license (see LICENSE.md) — the package trusts you either way. |
ResolvedCustomNodeActivationinterfaceSource ↗
What [resolveCustomNodeActivation](resolveCustomNodeActivation) found under a pointer target.
The RAW decode, before the definition's fromDocx has had its say — use activatedCustomNodeOf for the enriched form every host hook receives.
interface ResolvedCustomNodeActivation| Member | Type | Summary |
|---|---|---|
| controlId | string | null | The control's canonical node id, from the chrome layer — for review-item lookups. |
| definition | AnyCustomNodeDefinition | |
| node | ActivatedCustomNode | RAW decode: attrs straight from the tag, `fromDocx` not yet applied. |
ResolvedReviewPaneinterface
The review pane settings in force, with every field resolved.
interface ResolvedReviewPane| Member | Type | Summary |
|---|---|---|
| commentMarkers | CommentMarkerStyle | How a collapsed comment marker looks. |
| opening | ReviewPaneOpening | When the pane opens by itself. |
| overflow | ReviewPaneOverflow | What the open pane does when its card column does not fit beside the page. |
| revisionsIn | RevisionDisplay | Where tracked changes open. |
ReviewActionPropsinterfaceSource ↗
Props for the action parts, which also take an icon.
interface ReviewActionProps extends ReviewPartProps| Member | Type | Summary |
|---|---|---|
| icon? | ReactNode | Icon override; falls back to `children`, then to the part's default glyph. |
ReviewActivationOptionsinterface
How activating a review item places it in the viewport, and whether it announces the reveal.
interface ReviewActivationOptions| Member | Type | Summary |
|---|---|---|
| announce? | boolean | Whether a successful activation fires the `reviewItemReveal` event. Default `false`. |
| reveal? | ScrollPlacement | false | Where the item lands, or `false` to open it without scrolling at all. |
ReviewAdoptOptionsinterfaceSource ↗
Who and when an adopted change records.
interface ReviewAdoptOptions| Member | Type | Summary |
|---|---|---|
| author? | string | The author to record. Defaults to the editor's `author`, the person reviewing. |
| date? | Date | The date to record. Omit it to keep each change's own date. |
ReviewBalloonPropsinterfaceSource ↗
Props for DocxEditorReview.Balloon, the balloon that opens a review item at its text: each tracked change under revisionsIn: 'balloons', and format and structural changes in every mode.
interface ReviewBalloonProps| Member | Type | Summary |
|---|---|---|
| className? | string | A class added to the balloon element. |
ReviewDraftPropsinterfaceSource ↗
Props of DocxEditorReview.Draft.
interface ReviewDraftProps extends ReviewPartProps| Member | Type | Summary |
|---|---|---|
| left? | number | null | Rail-local `left` for the COMPACT rail, where the strip is 32px wide and a box laid out at column width would be cut by the viewport's edge. Omit it to use the compact card's position in the compact rail and the rail's own column otherwise. Null keeps the box in the rail's own column. |
| top? | number | Rail-local `top` in CSS pixels. Omit it to use the packaged card stack's position. Pass your own when you render your own cards, so the box stacks with them. |
ReviewItemRevealEventinterface
The payload of the reviewItemReveal event.
interface ReviewItemRevealEvent| Member | Type | Summary |
|---|---|---|
| key | string | The key of the review item to open, as `getReviewItems({ pairReplacements: false })` lists it, so for a replacement this is the key of its deletion or its insertion. Next Change and Previous Change stop once on a replacement and report its deletion's key, with the pair's key in [ReviewItemRevealEvent.pairKey](ReviewItemRevealEvent.pairKey). `setActiveReviewItem` reports the key it was given, so a call with a pair's key reports that key here and in [ReviewItemRevealEvent.pairKey](ReviewItemRevealEvent.pairKey). |
| pairKey? | string | The key that `getReviewItems()` gives the replacement this item belongs to, since it pairs replacements by default. Present only when the item is a paired replacement or one half of one. A host that reads the default list opens `pairKey ?? key`. |
| source | ReviewItemRevealSource | What asked for the item. `'navigate'` is Next Change or Previous Change, from the menu, the toolbar, a shortcut, or `exec({ type: 'navigateReviewChange' })`. `'host'` is a call to `setActiveReviewItem` (and so `useReview().setActive`) with `announce: true`. |
ReviewMarkersPropsinterfaceSource ↗
Props for the collapsed rail's gutter markers.
scale, offset and window are the rail's own geometry and are supplied for you — an override inherits them, so a host passes only what it wants to change.
interface ReviewMarkersProps| Member | Type | Summary |
|---|---|---|
| className? | string | |
| icon? | ReactNode | ((item: ReviewItemView) => ReactNode) | Replace the glyph. A FUNCTION of the item, unlike the action parts' plain node, because one `Markers` draws every marker in the gutter — a single node would put one shape on all of them, which is the thing this part was fixed to stop doing. Return null or undefined for an item to keep its packaged glyph. |
| offset? | number | |
| scale? | number | |
| window? | {
top: number;
bottom: number;
} | null | Visible band of the scroller; markers outside it are not mounted. |
ReviewModuleOptionsinterfaceSource ↗
How [reviewModule](reviewModule) is configured. Every field is optional, so reviewModule() with no argument is the ordinary call.
interface ReviewModuleOptions extends ProLicenseOptions| Member | Type | Summary |
|---|---|---|
| compareWorker? | (() => Worker) | false | The worker that runs the Compare documents dialog's compares off the page's main thread, so the page stays responsive, the dialog shows progress, and Cancel stops a running compare. By default, the editor starts the packaged worker, `@docx-editor.dev/pro/compare-worker`, one for each compare. |
| pane? | ReviewPaneOptions | The review pane settings the editor starts with. Change them later with `editor.setReviewPaneOptions()`, and read them from `snapshot.reviewPane`. Pass `{ opening: 'manual' }` when the host shows review items its own way, for example in balloons or margin markers, and opens the pane only on demand. An unknown field or value throws a `TypeError`. |
ReviewPaneOptionsinterface
Review pane settings to change. Every field is optional, and an omitted field keeps its current value.
interface ReviewPaneOptions| Member | Type | Summary |
|---|---|---|
| commentMarkers? | CommentMarkerStyle | Default `'icon'`. |
| opening? | ReviewPaneOpening | Default `'auto'`. |
| overflow? | ReviewPaneOverflow | Default `'float'`. |
| revisionsIn? | RevisionDisplay | Default `'pane'`. |
ReviewPartPropsinterfaceSource ↗
Shared props for every part.
interface ReviewPartProps| Member | Type | Summary |
|---|---|---|
| asChild? | boolean | Merge this part's wiring onto the single child element instead of the default one. |
| children? | ReactNode | |
| className? | string |
ReviewPropsinterfaceSource ↗
Props for DocxEditor.Review.
interface ReviewProps extends Omit<ReviewPartProps, 'children'>| Member | Type | Summary |
|---|---|---|
| card? | {
className?: string;
} | Class for each card. The rail's own `className` styles the column; this the boxes in it. |
| children? | ReactNode | ((item: ReviewItemView) => ReactNode) | Compound parts for the rail and its implicit List. A function remains supported as the legacy shorthand for a List render callback, but cannot be combined with root siblings; prefer an explicit `<Review.List>{item => ...}</Review.List>` in new code. |
| filter? | (item: ReviewItemView) => boolean | Show only some of the queue — comments in one rail, revisions in another. |
| formatting? | boolean | Show formatting changes in the rail. Default `false`: inspect formatting in the page balloon. Changes without a painted formatting anchor stay in the sidebar. Set `true` to include all formatting decisions in the sidebar. |
| furniture? | ReactNode | Host content at the top of the rail, above the cards — filters, legends, summaries. |
| gap? | number | Gap (px) between stacked cards. The only source of vertical spacing in the rail. |
| preset? | boolean | Render the packaged arrangement. `false` mounts the rail and its context only, so a host can lay the cards out itself while keeping the subscription and the anchoring. Explicit compound parts still inherit root-owned geometry; no omitted part is added back. |
| stack? | boolean | Stack cards so they never overlap, pushing later ones down. `false` leaves every card on its raw anchor, which is right for a rail that draws connectors instead. |
| structural? | boolean | Show structural changes in the sidebar. Default `true`: row, cell, merge, and numbering decisions must remain discoverable even without a clickable page marker. Set `false` to hide their cards; painted row markers still open a balloon. |
| t? | ToolbarTranslate | Label resolver, as `DocxEditor.Toolbar`, `.Menu` and `.ContextMenu` take one. Unresolved keys fall back to the bundled catalogue rather than to the key. |
ReviewRailMetricsinterfaceSource ↗
Where a review column sits, in the coordinates of the editor's scroll container.
Review anchors (item.anchorY) and stacked positions (useStackedReviewPositions) are in layout points from the top of the first page. These values convert them to CSS pixels.
interface ReviewRailMetricsPosition a card at its stacked anchor
```ts
const top = metrics.top + positions.get(item.key)! * metrics.scale;
```| Member | Type | Summary |
|---|---|---|
| compact | boolean | The review pane is open, but the viewport is too narrow for a full column beside the page. The packaged rail then shows markers and one floating card, the active item's, at `compactCardLeft`. |
| compactCardLeft | number | null | The `left` value, relative to [ReviewRailMetrics.left](ReviewRailMetrics.left), that puts a 300px card fully inside the visible area with a 12px inset from its edge on the column's side. Use it while [ReviewRailMetrics.compact](ReviewRailMetrics.compact) is true. `null` until there is a page to measure. |
| left | number | null | CSS pixels from the scroll container's left padding edge, in its scrolled content, to the column's left edge: one 16px gutter right of the page, or, in a right-to-left interface, one 16px gutter and the column's own width left of it. `null` until there is a page to measure. Keep the column hidden while it is `null`. |
| scale | number | CSS pixels per layout point, zoom included. |
| side | 'left' | 'right' | The page side the column stands on: `'left'` in a right-to-left interface, otherwise `'right'`. On the left, give the column its width (300px for the packaged cards), because `left` keeps the column's RIGHT edge one gutter off the page; and keep each card's air on its left, away from the page. |
| top | number | CSS pixels from the scroll container's top padding edge, in its scrolled content, to the top of the first page. Content above the pages, such as a host banner inside the viewport, is included. Scrolling does not change it. |
ReviewWriteRefusalinterfaceSource ↗
A review write the editor refused.
interface ReviewWriteRefusal| Member | Type | Summary |
|---|---|---|
| action | ReviewWriteAction | Which write was refused. A discarded tracked change reports `'reject'`. |
| code | EditDiagnosticCode | ReviewDiagnosticCode | The public diagnostic code, the same one `onDiagnostic` reports for the refusal. A tracked change the engine could not decide names its review code, such as `review.retained-structure` for a row that stays to keep a nested table. |
| final | boolean | True when retrying cannot help: the collaboration session ended, so the document must be opened again before it takes another review write. |
| key | string | null | The card the write addressed, or null for a new comment on the selection. |
| sequence | number | Rises with every refusal of this editor, so the same refusal twice still differs. Key a live announcement on it to announce a repeat. |
UseCollaborationStatusReturninterfaceSource ↗
Status returned by [useCollaborationStatus](useCollaborationStatus).
interface UseCollaborationStatusReturn| Member | Type | Summary |
|---|---|---|
| attached | boolean | An editor has attached its document port to this replica. |
| diverged | boolean | This replica no longer agrees with the room, and waiting will not fix it. |
| failureCount | number | How many failures the session has recorded. It changes with each new failure, also when `lastFailure` repeats the same code, so a host can tell a user each time an edit is refused. |
| lastFailure | CollaborationFailure | undefined | The most recent `error` reason. Kept after the session recovers. |
| live | boolean | Edits made now reach the room. |
| reason | CollaborationFailure | undefined | Why the session holds `status`, or `undefined` when nothing is wrong. |
| recovering | boolean | The session is in `error` but heals by itself on the next clean update: show a passing notice, not a rejoin action. |
| status | CollaborationStatus | 'inactive' | Current lifecycle state, or `inactive` when no session is attached. |
| waiting | boolean | Edits wait for the room: an update arrived that depends on one still on its way. The editor refuses edits until it arrives or the wait times out. |
UseDocumentCollaborationOptionsinterfaceSource ↗
Input for [useDocumentCollaboration](useDocumentCollaboration).
interface UseDocumentCollaborationOptions| Member | Type | Summary |
|---|---|---|
| modules? | readonly EditorModule[] | Host modules. The hook adds `collaborationModule` when a room is ready. A host collaboration contribution is a configuration error and throws. |
| room? | UseDocumentCollaborationConnectOptions | null | Connect this room on mount. Omit it and call [UseDocumentCollaborationReturn.connect](UseDocumentCollaborationReturn.connect) after the host has a `ydoc` and a room. A different room, server, bootstrap kind, or `actorId` leaves the old room and connects the new one, and `null` leaves. A room opened with `connect` stays. |
UseDocumentCollaborationReturninterfaceSource ↗
Values [useDocumentCollaboration](useDocumentCollaboration) returns.
interface UseDocumentCollaborationReturn| Member | Type | Summary |
|---|---|---|
| connect | (options: UseDocumentCollaborationConnectOptions) => Promise<CollaborationFailure | null> | Connect a room. RESOLVES with the failure, or null on success — it does not reject. |
| document | Uint8Array | null | The room's document as `.docx` bytes to mount. Null until the room is ready. |
| error | CollaborationFailure | null | The connect failure or session failure, or null. Check it before `document`. |
| leave | (nextDocument: Uint8Array) => void | Destroy the session and carry on editing locally. |
| modules | readonly EditorModule[] | Modules to pass to the editor. They include the collaboration module once ready. |
| pending | boolean | True while a connect is in progress. |
| session | CollaborationSession | null | The live session for status and presence. Null while no room is connected. |
UseReviewRailMetricsOptionsinterfaceSource ↗
Options for [useReviewRailMetrics](useReviewRailMetrics).
interface UseReviewRailMetricsOptions| Member | Type | Summary |
|---|---|---|
| reserveGutter? | boolean | With a `railRef`, reserve the review gutter beside the page while the column element is mounted, as `DocxEditorReview` does. The viewport then shifts the page away from the column while the pane is open. The reservation does not show the comment controls in the toolbar and the context menu; see `ReviewRailContext` to serve them from your column. Set `false` when a mounted `DocxEditorReview` already reserves the gutter, or when your column overlays the page. Default: `true`. |
| trackScroll? | boolean | Re-measure while the scroll container scrolls. Only `compactCardLeft` changes with scrolling, and only when the page is wider than the viewport. Default: `false`. |
UseReviewReturninterfaceSource ↗
What [useReview](useReview) returns: the review rail's data and the things a card can do.
interface UseReviewReturn| Member | Type | Summary |
|---|---|---|
| accept | (item: ReviewItemView) => boolean | Accept a revision. Reports whether it landed. |
| activatedKey | string | null | The key of the ACTIVATED item: the one [setActive](setActive), Next Change, or Previous Change made active, while the caret stays in it. `null` when only a caret move made an item active. [activeKey](activeKey) is the caret-active item instead: the one the caret is in, however it got there. The key follows this hook's query, so a paired replacement reports the pair's key under `pairReplacements: true`. The same value as the editor's `getActivatedReviewItemKey(query)`, read on every selection change. |
| activeKey | string | null | The CARET-ACTIVE item: the one the caret is in, or null. |
| adopt | (items: ReviewItemView | readonly ReviewItemView[], options?: ReviewAdoptOptions) => boolean | Adopt tracked changes as the reviewer's own: they record the reviewer as their author and stay pending for the next reviewer. |
| comment | (text: string, author?: string) => boolean | Comment on the current selection. Reports whether it landed, like [reply](reply). |
| commentResolutionDisabledReason | string | null | Why Resolve and Reopen are unavailable, or null. |
| items | readonly ReviewItemView[] | Every pending decision in the document, in reading order. |
| lastRefusal | ReviewWriteRefusal | null | Why the last accept, reject, resolve, reopen, remove, reply or comment did not land, or null. |
| paneOpen | boolean | Whether the pane shows cards. Engine state: the toolbar's comments button toggles it. |
| ready | boolean | False until the engine has a document, so a surface can render nothing rather than empty. |
| reject | (item: ReviewItemView) => boolean | Reject a revision. Reports whether it landed, on the same terms as [accept](accept). |
| remove | (item: ReviewItemView) => boolean | Discard the item: delete a comment thread, or reject a tracked change. |
| reopen | (item: ReviewItemView) => boolean | Reopen a resolved comment thread. Repeating this on an open thread is likewise idempotent. |
| reply | (item: ReviewItemView, text: string, author?: string) => boolean | Reply to a comment, or to a revision — which OOXML records as a comment on its range. |
| resolve | (item: ReviewItemView) => boolean | Resolve a comment thread. Repeating this on a resolved thread succeeds without a write. |
| selectionAnchorY | number | null | Where a comment on the current selection would sit, or null when nothing is selected. |
| setActive | (key: string | null, options?: ReviewActivationOptions) => boolean | Card to document: puts the caret at the start of the item's range and scrolls to it. Nothing is selected; the open item draws its own highlight. |
| setPaneOpen | (open: boolean) => void | Open or close the pane — the same toggle the toolbar button runs. |
Type aliases (15)
CollaborationBootstraptypeSource ↗
Create or join bootstrap for one collaboration replica.
The document and WebRTC factories share this union.
create-or-join removes the out-of-band decision about which peer creates a room. The replica probes for an initialized room and joins it when one appears. Otherwise it runs a short awareness election and only the winning candidate seeds from document. A room that two peers seeded concurrently reports the terminal failure code concurrent-seed on every replica.
type CollaborationBootstrap = {
readonly kind: 'create';
readonly document: Uint8Array;
} | {
readonly kind: 'join';
readonly timeoutMs?: number;
readonly signal?: AbortSignal;
} | {
readonly kind: 'create-or-join';
readonly document: Uint8Array;
readonly probeTimeoutMs?: number;
readonly electionWindowMs?: number;
readonly timeoutMs?: number;
readonly signal?: AbortSignal;
};CollaborationFailureCodetype
Why a replica refused work, left ready, or failed a schema check.
Free-form extras (a transport phrase, a blob key, a store refusal) travel in [CollaborationFailure.detail](CollaborationFailure.detail), not here. Branch on the code; log the detail.
Codes are grouped by cause, and each group comment names the host action. In error, only a remote update that is not applied yet, or one refused local edit, heals on its own. The failure codes table in the collaboration reference lists every code. transport-disconnected and authentication-failed need opposite answers: wait for the first; refresh the credential and rejoin for the second. room-generation-changed means the server compacted the room while this replica was away: save a copy if it holds unsent changes, then rejoin.
type CollaborationFailureCode =
/** Edit refused by the session gate. The status does not change. Wait for `ready`. */
'collaboration-session-destroyed' | 'collaboration-session-not-attached' | 'collaboration-session-not-ready' | 'collaboration-text-limit' | 'experimental-collaboration-body-text-only'
/** Factory input rejected before joining. Fix the value the host passed. */
| 'invalid-document-id' | 'invalid-identity' | 'invalid-identity-color' | 'invalid-session-id'
/** Join or seed did not complete. Connect the provider, check the room id, and retry. */
| 'already-initialized' | 'document-id-mismatch' | 'initialization-aborted' | 'initialization-timeout' | 'not-initialized'
/** The seed document cannot seed a room. Fix the file. */
| 'baseline-too-large' | 'blob-read' | 'invalid-baseline' | 'missing-local-blob' | 'no-main-document-part'
/** This client and the room have different formats. Terminal. Save local work. */
| 'collaboration-format-mismatch' | 'protocol-version-mismatch' | 'schema-version-mismatch'
/** The room is unusable. Terminal. Create a new room from saved bytes. */
| 'blob-digest-mismatch' | 'concurrent-seed' | 'port-already-attached'
/** A remote update is not applied yet. Heals when a later update arrives. Wait. */
| 'duplicate-paragraph-id' | 'invalid-relationships' | 'materialize-dropped-content' | 'missing-blob' | 'missing-root' | 'remote-apply-failed' | 'unknown-paragraph-id'
/** Over a resource limit. A local edit realigns; shared state over a limit is terminal. */
| 'blob-store-full' | 'blob-too-large' | 'invalid-blob-descriptor' | 'invalid-bound' | 'invalid-logical-id' | 'invalid-string' | 'prototype-key' | 'text-too-long' | 'too-many-attributes' | 'too-many-children' | 'too-many-nodes' | 'too-many-parts' | 'too-many-relationships' | 'tree-too-deep' | 'unknown-logical-id' | 'unsafe-part-name'
/** Transport state. Only `transport-disconnected` recovers on its own. */
| 'authentication-failed' | 'room-generation-changed' | 'transport' | 'transport-disconnected'
/** Reserved for a room server that refuses a saved room. Passed through, never emitted. */
| 'invalid-saved-room' | 'saved-room-unavailable'
/** @deprecated Emitted by nothing. Kept for compatibility; do not branch on these. */
| 'baseline-digest-mismatch' | 'experimental-collaboration-existing-paragraphs-only' | 'experimental-collaboration-text-only' | 'experimental-collaboration-untracked-text-only' | 'immutable-baseline-changed' | 'immutable-metadata-changed' | 'invalid-shared-metadata' | 'local-mirror-failed' | 'paragraph-set-mismatch' | 'shared-schema-invalid' | 'unsupported-root-key';CollaborationNoticeKindtypeSource ↗
The notice the status part shows, or none while everything is in order.
- connecting: the session is joining the room. - offline: the transport is down and edits continue; they sync on reconnect. - offlinePaused: the transport is down and the session refuses edits until reconnect (offlineEditing: false). - syncing: the session hit an update it could not apply yet and heals on the next one. - waiting: edits wait until an update the room sent can apply. - stalled: edits have waited longer than STALLED_AFTER_MS; rejoining loads the room. - editRefused: the room refused the last edit, and the editor undid it. - outOfSync: this copy no longer agrees with the room; rejoining loads the room's copy. - upgradeRequired: this client and the room use different collaboration formats, and either side can be the older one. A rejoin cannot fix it; an upgrade of the older side can. - newRoomRequired: the room itself cannot continue (two seeds merged, a damaged blob, or a resource limit); a rejoin cannot fix it. Save a copy and share it in a new room.
type CollaborationNoticeKind = 'connecting' | 'offline' | 'offlinePaused' | 'syncing' | 'waiting' | 'stalled' | 'editRefused' | 'outOfSync' | 'upgradeRequired' | 'newRoomRequired';CollaborationSelectionKindtype
How a published selection covers the document.
Absent or omitted means a character range. cells means the table rectangle whose corner cells contain the two endpoints. The payload still carries only those endpoints, so a large table selection does not grow with the number of selected cells.
type CollaborationSelectionKind = 'cells';CollaborationStatustype
Lifecycle state of one collaboration replica.
One axis, because the only question a host has to answer is whether to tell the reader to wait or to reload:
- initializing — joining. Edits are refused. Recovers on its own. - ready — replicating. Accepts edits. - disconnected — the transport dropped. The replica is intact and recovers on its own, so wait rather than reload. Edits continue by default, and the buffered updates merge on reconnect. A session created with offlineEditing: false refuses them until reconnect. - error — this replica does not agree with the room. Edits are refused. [CollaborationStatusSnapshot.reason](CollaborationStatusSnapshot.reason) says why. A remote update the replica could not apply yet heals when a later update completes shared state ([CollaborationStatusSnapshot.recovering](CollaborationStatusSnapshot.recovering)). A format or version mismatch needs an upgrade of this client or the room; every other cause needs a rejoin. - destroyed — torn down. Terminal.
type CollaborationStatus = 'initializing' | 'ready' | 'disconnected' | 'error' | 'destroyed';CommentMarkerStyletype
How a collapsed comment marker looks.
- 'initials': a badge with the thread author's initials in the author's color, a reply count, and a check mark when the thread is resolved. - 'icon': the comment icon.
type CommentMarkerStyle = 'initials' | 'icon';ReviewDiagnosticCodetype
Why accepting, rejecting or re-authoring a tracked change skipped an item.
type ReviewDiagnosticCode = 'review.revision-unsupported' | 'review.incomplete-group' | 'review.retained-structure' | 'review.locked-content' | 'review.bound-content' | 'review.stale-revision';ReviewItemRevealSourcetype
What asked to reveal a review item. See [ReviewItemRevealEvent.source](ReviewItemRevealEvent.source).
type ReviewItemRevealSource = 'navigate' | 'host';ReviewItemViewtypeSource ↗
One card's data plus where it belongs on screen.
The engine's own placement, unchanged. It is already presentation-ready — author, initials, date, text, thread — because deriving those from the canonical tree is engine work, and an adapter deriving them would be document derivation in a host and would have to be written once per framework.
type ReviewItemView = ReviewItemPlacement;ReviewPaneOpeningtype
When the review pane opens by itself.
- 'auto': the pane opens when a document with review items loads, and when a tracked change is made while it is closed, in both cases when the pane has items to list. With revisionsIn: 'balloons' the pane lists no tracked change and no reply to one, so tracked changes and their replies alone do not open it. - 'manual': the pane stays closed until the host or the user opens it. Use it when the host shows review items its own way, such as in balloons or margin markers.
type ReviewPaneOpening = 'auto' | 'manual';ReviewPaneOverflowtype
What the open review pane does when its full card column does not fit beside the page at the page's zoom.
- 'float': the pane shrinks to a strip of markers, and the open card floats over the page. - 'shrinkPage': under a fit zoom mode, the page may shrink down to the mode's minZoom (or 10%) so that the full column fits. The pane changes to the marker strip only when the column does not fit at that floor either. A fixed zoom behaves as 'float'. - 'scroll': the page keeps the size it has beside the closed pane's marker strip, and the full column stands beside it. The document and the column scroll together: the viewport scrolls sideways to reach the cards.
The setting applies to the review pane only. The navigation pane stays docked at its side in every mode: it never scrolls with the document, and it takes its room beside the page exactly as it does with no review pane.
type ReviewPaneOverflow = 'float' | 'shrinkPage' | 'scroll';ReviewWriteActiontypeSource ↗
The review write a refusal answered.
type ReviewWriteAction = 'accept' | 'reject' | 'resolve' | 'reopen' | 'remove' | 'reply' | 'comment';RevisionDisplaytype
Where tracked changes open.
- 'pane': the review pane lists tracked changes as cards beside the comments. - 'balloons': the pane lists comments only, except comments that reply to a tracked change: the change's balloon shows those. A tracked change opens in a balloon at its text when the reader clicks it, or when Next Change, Previous Change, or setActiveReviewItem(key, { announce: true }) reaches it. A replacement is one balloon. In both settings, Next Change and Previous Change stop on a replacement once.
type RevisionDisplay = 'pane' | 'balloons';ScrollPlacementtype
Where a scroll places its target in the viewport.
- 'start': near the top, like a jump to a heading. - 'center': centred. - 'centerIfNeeded': still while the target is on screen, centred when it has to move. - 'nearest': the minimum scroll, which leaves the target at the edge it came in from.
Each method that takes a placement states its own default.
type ScrollPlacement = 'start' | 'center' | 'centerIfNeeded' | 'nearest';UseDocumentCollaborationConnectOptionstypeSource ↗
Arguments for [UseDocumentCollaborationReturn.connect](UseDocumentCollaborationReturn.connect): the createDocumentCollaboration options. The consumer owns ydoc, awareness, and whatever provider replicates them.
type UseDocumentCollaborationConnectOptions = CreateDocumentCollaborationOptions;Variables (2)
DocxEditorCollaborationconstSource ↗
Presence chrome over a live collaboration session.
Compose the parts inside DocxEditor.Root with the collaboration module registered:
DocxEditorCollaboration: DocxEditorCollaborationNamespace```tsx
<DocxEditorCollaboration.Avatars session={session} max={4} />
<DocxEditorCollaboration.Status session={session} onRejoin={rejoin} />
<DocxEditorCollaboration.CaretLabels session={session}>
{({ selection, color }) => <MyLabel name={selection.name} color={color} />}
</DocxEditorCollaboration.CaretLabels>
```DocxEditorReviewconstSource ↗
The review rail: comments and tracked changes as a compound component.
DocxEditorReview is itself the root; every part hangs off it, so a host arranges the pieces it wants rather than accepting one fixed layout. Requires the review module to be registered via createDocxEditor({ modules: [reviewModule()] }) — without it there is nothing to derive cards from.
PARTS AND SCOPES. The rail reads its parts from its own children, by element type. There are two scopes:
- Root parts: List, Markers, AddComment, Draft, and Balloon. Put them as DIRECT children of DocxEditorReview (fragments are transparent). The rail gives them the geometry only it can compute: the comment button's and the compose box's top, and the markers' scale and window. A root part inside a wrapper component is not seen as a part. It renders as ordinary content, without that wiring. - Card parts: Card, Empty, and the parts inside a card (Author, Summary, Accept, Reject, Reply, and the others). Put them inside DocxEditorReview.List, or as other direct children, which become the card template.
preset={false} drops the packaged defaults. Root parts you pass still get their wiring, and every other child renders as is inside the rail, where useReviewRailMetrics() reads the rail's own measurement. To render your own cards, use useReview().items, useStackedReviewPositions, and useReviewRailMetrics. Draft without top sits where the packaged card stack puts it, so pass top from your own stack.
In a browser host, this rail and useReview() are the way to build a review UI. For headless, server, or agent pipelines, use @docx-editor.dev/editor-api.
DocxEditorReview: DocxEditorReviewNamespace```tsx
<DocxEditorReview>
<DocxEditorReview.List>
<DocxEditorReview.Card>
<DocxEditorReview.Author />
<DocxEditorReview.Summary />
<DocxEditorReview.Accept />
<DocxEditorReview.Reject />
</DocxEditorReview.Card>
</DocxEditorReview.List>
</DocxEditorReview>
```Namespaces (1)
CustomNodeContextMenunamespaceSource ↗
declare namespace CustomNodeContextMenu| Member | Type | Summary |
|---|---|---|
| docxRowPlacement | "start" |