AI agent
JS behaviour
Diff viewer
A line diff of two texts (Myers) in unified or split view, with unchanged hunks folded behind “expand” and the additions/deletions counted.
Real scenarios
The component as it is used in a product — not a specimen grid.
lang/fa/shop.php
No changes
.github/workflows/tests.yml
No changes
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| old-text / new-text | string | "" | The previous and the new version. |
| view | string | unified | unified or split; the reader switches it in the header. |
| context | int | 3 | Unchanged lines kept beside each change. |
| filename / max-height | string | null | The file name in the header and the maximum height. |
Snippet
<x-nx::diff-viewer filename="config/cache.php" :old-text="$before" :new-text="$after" view="split" />