Skip to content
Design System
GitHub

Text diff

v0.16.2Beta

Where two texts differ, word by word: insertions a grey block with an underline, removals struck through, each announced to screen readers. Inline or side by side, with a +3 words, −1 word summary.

API reference

Generated from the types. Every part also takes className.

TextDiff

Also takes every prop of <div> (except children).

beforerequired
string
afterrequired
string
mode
"inline" | "side-by-side" = "inline"inline: one text with both kinds of change marked. side-by-side: before on the left with its removals, after on the right with its insertions.
beforeLabel
string = "Before"Column headings in side-by-side mode, e.g. "Base model" and "Fine-tuned".
afterLabel
string = "After"
showSummary
boolean = trueThe "+3 words, −1 word" line above the text.
labels
Partial<TextDiffLabels>