Customization

Comments and review cards

Customize DOCX editor comment boxes and tracked change cards with named parts, card templates, and CSS state attributes.

Customize the cards in the review column with named DocxEditorReview parts. Review controls require the review module and an EigenPal Pro License.

Customize a review card

Pass a class to every card through card. Named parts replace packaged parts in place.

import { DocxEditor } from '@docx-editor.dev/react';
import { reviewModule, DocxEditorReview } from '@docx-editor.dev/pro/react';

const modules = [reviewModule()];

<DocxEditor.Root document={bytes} modules={modules}>
  <DocxEditor.Viewport style={{ height: 520 }}>
    <DocxEditor.Content />
    <DocxEditorReview card={{ className: 'contract-card' }}>
      <DocxEditorReview.Summary className="contract-comment-body" />
      <DocxEditorReview.Replies className="contract-thread" />
    </DocxEditorReview>
  </DocxEditor.Viewport>
</DocxEditor.Root>;

Style cards under your editor wrapper. Match presence attributes as [data-active], not [data-active="true"].

.docx-editor.contract-workspace .contract-card {
  border-radius: 12px;
  border-inline-start: 3px solid var(--doc-review-author-current);
  background: var(--doc-surface);
}
.docx-editor.contract-workspace .contract-card[data-active] {
  background: var(--doc-review-card-active-bg);
}

Formatting cards describe tracked highlight changes, such as Highlight: yellow. For custom cards, ReviewRevisionItem.formattingChanges includes highlight with the w:highlight color name, such as yellow.

Replace the card template

A React List render prop or a Vue #item slot takes over the card. Wrap it in Card so parts can read the item.

<DocxEditorReview>
  <DocxEditorReview.List>
    {(item) => (
      <DocxEditorReview.Card className="contract-card">
        <DocxEditorReview.Author />
        <p>{item.text}</p>
        <DocxEditorReview.Accept />
        <DocxEditorReview.Reject />
        <DocxEditorReview.Reply />
      </DocxEditorReview.Card>
    )}
  </DocxEditorReview.List>
</DocxEditorReview>

Inside the card, useReviewItem() reads the item and useReviewAuthor(item.author) returns its color and avatar. A template also replaces the compact resolved-comment view.

Configure cards and markers

DocxEditorReview propDefault and use
classNameStyles the review column.
card.classNameAdds a class to every card.
presettrue. false composes the column yourself.
stacktrue. false keeps cards at raw anchors.
gapPixels between cards. Use it instead of card margins.
filterChooses which items the column shows.
structuraltrue. Keeps structural decisions in the column.
formattingfalse. Formatting with page anchors uses balloons.
furnitureApplication content at the column start.
tResolves review labels.
PartUse
List, CardItem rendering and card wrapper.
Avatar, Author, Time, SummaryAuthor, metadata, and comment or change text.
Accept, Reject, Resolve, Reopen, DeleteDecisions and thread actions. Take icon.
Replies, Reply, Draft, AddComment, EmptyReplies, inputs, and empty state.
MarkersCollapsed markers. icon takes a node or an item callback.
BalloonBuilt-in balloon. Only className and hidden.

Parts accept className, hidden, asChild, and children where supported. The commentMarkers review pane setting picks initials or a comment icon for markers.

Cards expose data-kind (comment, custom item, or change kind), data-active, data-resolved, data-resolved-miniature, data-review-author, data-review-author-slot, and data-node-name (custom node type).

For card, comment, and author color tokens, see Review colors and styling.

Limits

  • filter never resolves items and gives no other route to a hidden decision.
  • For a comments-only column, set revisionsIn: 'balloons'. Changes then open in balloons at their text. See Tracked changes.
  • Keep the actions your workflow needs. Hide a part only when another route exists.
  • Show refused writes and unavailable actions. Keep reply focus while the user types, and the document selection when an action only opens controls.
  • Keep the column's geometry props in a Markers override.
  • With preset={false}, convert anchors with useReviewRailMetrics(). See Place custom cards.

See also