f0rextasy

Diff Editor

Component

About

A side-by-side editable text diff viewer that highlights lines added, removed or changed between two versions of code or text.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Diff Editor to your project and fits it to your theme.

Code

How Diff Editor is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import { DiffEditor } from "@/components/ui/diff-editor";

export default function DiffEditorDemo() {
  const [before, setBefore] = React.useState("const prev = 1;");
  const [after, setAfter] = React.useState("const next = 2;");

  return (
    <div className="flex w-full items-center justify-center bg-background p-8">
      <DiffEditor
        before={before}
        after={after}
        onBeforeChange={setBefore}
        onAfterChange={setAfter}
        className="max-w-xl"
      />
    </div>
  );
}

More by f0rextasy

View all
  • Newsletter Signup Card

    Newsletter Signup Card

    15
  • Board Checklist

    Board Checklist

    12
  • Stamp Seal

    Stamp Seal

    12
  • Network Graph

    Network Graph

    12
  • Empty State Card

    Empty State Card

    6
  • Payment Methods

    Payment Methods

    6
  • Two Factor

    Two Factor

    6
  • Navbar

    Navbar

    6