Diff Review, animated React component
An inline review of AI edits to a paragraph, with removals struck through in red and additions typed in green. Accept all folds the old words away, Reject folds the new ones away, and clicking a single change takes just that one.
- Pro
- AI Components
Chimes softly when you press Accept all, switches off with a quiet click on Reject and taps when you take a single change; autoplay makes the accept sound once the visitor has used the page. Sound is off on this site until you switch it on.
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
Our app helps teams manage projects. Try it free for 14 days.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| parts | DiffPart[] | DIFF_REVIEW_PARTS | The paragraph as [kind, text] runs, where kind is "same", "del" or "ins". A del followed by an ins is one replacement; a lone del is a removal. |
| title | string | "Homepage · Hero copy" | Small label above the text box. |
| width | number | 520 | Width of the card in px. It never grows past its container. |
| autoplay | boolean | false | Improves the writing, accepts every edit and returns to the draft on a loop until someone touches the card. Only runs while the card is on screen and never under reduced motion. |
| className | string | "" | Extra classes for the card. |
| enableSound | boolean | true | Plays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component. |
Diff Review questions
Does it make sound, and how do I turn it off?
Chimes softly when you press Accept all, switches off with a quiet click on Reject and taps when you take a single change; autoplay makes the accept sound once the visitor has used the page. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.