Ballmac UI home

Diff Viewer

A line-by-line text diff with change counts, line numbers, and accessible change labels.

settings.ts2 added · 2 removed
export const settings = {
Removed: theme: "light",
Removed: notifications: false,
Added: theme: "system",
Added: notifications: true,
autoSave: true,
}

Installation

$ pnpm dlx shadcn@latest add @ballmac/diff-viewer

Usage

import { DiffViewer } from "@/components/ballmac/diff-viewer"

The full example is in the Code tab above.

Examples

States and variants

release-notes.md1 added · 0 removed
## Changes
- Fixed search
Added: - Improved keyboard navigation
- Updated docs

API reference

PropTypeDefault
before*

Original text.

string—
after*

Updated text.

string—
label*

Accessible name, usually a filename.

string—
lineNumbers

Show line numbers in the gutter.

booleantrue

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Tab / Arrow keysFocuses and scrolls long diffs

Use with AI

A line-by-line text diff with change counts, line numbers, and accessible change labels. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Diff Viewer (@ballmac/diff-viewer) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Review before-and-after text changes

Not for

  • Use Comparison Table for product features

Registry JSON: https://ui.ballmac.com/r/diff-viewer.json

Credits

Free to use in personal and commercial projects.

npm
None