Skip to content

Inline Diff

A word-level diff for prose: removed words struck through, added words underlined, as one redline paragraph, a before line over an after line, or the new text alone.

oxyn add inline-diff
MCP
+0 words−4 words

Our agent is very careful with your data and it never shares it with anyone without asking you first.

Dioxus
rsx! {
    InlineDiff {
        before: "Our agent is very careful with your data…",
        after: "Our agent is careful with your data…",
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • Prose changed by an agent (a reply draft, a policy, release notes).
  • The user wants to read the new text and see exactly which words moved, without a code gutter. rewrite_chunks tokenises both texts into words, spaces and punctuation, runs an LCS, and merges two changes separated by a single space so an edit reads as one phrase.

When not to use

  • A launch countdown with digits that roll per unit, a compact one-line variant, hours absorbing days when days are hidden, and a live state with a pulsing dot at zero: use Countdown instead.
  • A total that moves clearly: use Animated counter instead.
  • A collapsible JSON tree with search, paging for long arrays, copy value or path, the current path under the tree and full keyboard moves: use JSON viewer instead.

Installation

Inline Diff is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add inline-diff
Rust
use crate::oxyn::{InlineDiff, STATUS_INDICATOR_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{InlineDiff, STATUS_INDICATOR_CSS};

Usage

Dioxus · rust
rsx! {
    InlineDiff {
        before: "Our agent is very careful with your data…",
        after: "Our agent is careful with your data…",
    }
}

Examples

Redline

Struck deletions and underlined insertions in one paragraph.

+0 words−4 words

Our agent is very careful with your data and it never shares it with anyone without asking you first.

Code
rsx! {
    InlineDiff {
        before: "Our agent is very careful with your data…",
        after: "Our agent is careful with your data…",
    }
}

Lines

A Before line over an After line.

+9 words−6 words

BeforeRefunds are available within 14 days of purchase, if the item is unused and you contact support by email.

AfterRefunds are available within 30 days of delivery, if the item is unused. Contact support in the app or by email.

Code
rsx! {
    InlineDiff {
        before: "Our agent is very careful with your data…",
        after: "Our agent is careful with your data…",
        form: "lines",
    }
}

After only

Only the new words, highlighted where they changed.

+0 words−4 words

Our agent is careful with your data and never shares it without asking you first.

Code
rsx! {
    InlineDiff {
        before: "Our agent is very careful with your data…",
        after: "Our agent is careful with your data…",
        form: "after-only",
    }
}

Review

Review mode: each change is a suggestion; the highlighted one carries Accept (Y) / Reject (N) above it, with prev / next, Reject all and Accept all below.

Suggested edit · Tighten it

Refunds are available within days of , if the item is unused by email.

3 suggestions
Code
rsx! {
    InlineDiff {
        before: "Our agent is very careful with your data…",
        after: "Our agent is careful with your data…",
        form: "review",
    }
}

Review partly

Two decided: the accepted wording reads as plain text, the rejected one is back to the original, the count drops and Undo appears.

Suggested edit · Tighten it

Refunds are available within 30 days of purchase, if the item is unused by email.

1 suggestion
Code
rsx! {
    InlineDiff {
        before: "Our agent is very careful with your data…",
        after: "Our agent is careful with your data…",
        form: "review",
    }
}

Review done

Everything decided: a green check, All changes reviewed and Undo.

Suggested edit · Tighten it

Our agent is careful with your data and never shares it without asking you first.

All changes reviewed
Code
rsx! {
    InlineDiff {
        before: "Our agent is very careful with your data…",
        after: "Our agent is careful with your data…",
        form: "review",
    }
}

Review classic

Classic review: the buttons sit above the text and changes are colour plus strike or underline, no tint.

Suggested edit · Tighten it

Refunds are available within days of , if the item is unused by email.

3 suggestions
Code
rsx! {
    InlineDiff {
        before: "Our agent is very careful with your data…",
        after: "Our agent is careful with your data…",
        form: "review",
    }
}

API reference

InlineDiff

PropTypeDefaultDescription
beforerequiredString—Old text.
afterrequiredString—New text.
formString"inline"`inline` · `lines` · `after-only`.
countsbooltrueShow the +/− word counts.
reviewboolDefault::default()Review mode: each change is a suggestion to accept (Y) or reject (N), one at a time or all at once, with Undo.
labelString"Suggested edit · Tighten it"Review mode: the line above the text.
decidedVec<Option<bool>>Default::default()Review mode: decisions made from the start (`Some(true)` accepted).
styleStringDefault::default()Review mode: `clean`, `classic`, or empty to follow `data-cstyle`.
on_changeEventHandler<String>—Review mode: the text after each decision.
on_doneEventHandler<String>—Review mode: the final text once nothing is left to decide.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
TabRead-only forms: no stops. Review: each suggestion, then the footer buttons
YorNReview: accept / reject the highlighted suggestion
EnterReview: highlight the focused suggestion

Accessibility

  • Deletions and insertions are real del and ins elements, so screen readers announce them; colour is paired with strike-through and underline.
  • In review every change is its own button whose name gives its place, the words it swaps and the Y / N keys; each decision is read out by a polite status line.
  • Neighbouring single-word changes merge into phrases, so the paragraph reads as a few edits, not confetti.
From the spec
  • Real del and ins elements, announced by screen readers; colour is paired with strike-through and underline.
  • The +N / −N word counts are text.

Motion & interaction

Timing
  • No motion of its own: it renders a settled diff. Hosts that stream wrap it in a text reveal.
  • Reduced motion: nothing to reduce.

Responsive behaviour

  • Wraps like any paragraph; fills its column up to 640 px.
Edge cases (spec)
  • Wraps like a paragraph; max 640 px.

Notes for AI

  • Import InlineDiff from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: InlineDiffEl in oxyn_gpui.
  • Props to set first: before, after.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI