Skip to main content
Pricing

Diff View

Pro

A code comparison component for displaying additions, deletions, and modifications between two versions of text. Supports side-by-side (split) and unified (inline) display modes with line numbers and colour-coded change markers. Used for code reviews, version history, and content auditing.

4 variants

4 border-radius: 8px;
5- color: #333333;
5+ color: var(--text-primary);
6+ background: var(--bg-surface);
7 padding: 16px;

Variants

VariantDescriptionWhen to use
Inline
Side by Side

Usage Guidelines

Do

Use green for additions and red for deletions — this is a universal convention.

Don't

Rely only on colour to indicate additions and deletions — use +/- markers too.

Do

Show line numbers for both old and new versions.

Don't

Show diffs for binary files — display a "Binary file changed" message instead.

Do

Allow toggling between unified and split views.

Don't

Auto-expand very large diffs — collapse them with an expand action.

Code

This component is included in Lexicon Pro

From €149 — one-time purchase, lifetime access

View pricing

Design Tokens

This component is included in Lexicon Pro

From €149 — one-time purchase, lifetime access

View pricing

Accessibility

  • Use role="region" with aria-label="Code changes" for the diff container.
  • Do not rely solely on colour — include +/- text markers for additions and deletions.
  • Line numbers should be aria-hidden to reduce screen reader verbosity.
  • Provide a text summary like "3 additions, 1 deletion" for screen readers.

Keyboard Interactions

TabMoves focus to interactive controls (view toggle, expand buttons).
Enter/SpaceToggles between unified and split view, or expands collapsed sections.