DS0
Components

DiffViewer

A diff viewer for comparing text changes with color-coded additions and deletions.

Overview

DiffViewer displays a side-by-side or unified diff of two text blocks, highlighting additions in green and deletions in red. Includes line numbers and optional word-level highlighting.

Usage

<DiffViewer
  oldValue={originalCode}
  newValue={modifiedCode}
  splitView
/>

API Reference

PropTypeDefaultDescription
oldValuestring''Original text
newValuestring''Modified text
splitViewbooleantrueSide-by-side vs. unified
showLineNumbersbooleantrueDisplay line numbers
languagestringSyntax highlighting language
ComponentWhen to Use Instead
CodeBlockSingle code block display
CodeInline code snippets

On this page