Rendyn

Component library

189 components

Agent UI

File Diff

File Diff renders explicit added, removed and context lines with optional copy text.

Interactive exampleReact Tailwind CSS

Practical React example

Let a reviewer inspect proposed file changes before any write occurs.

Before you copy and paste

Keep the example in the React rendering environment required by the imported component. Copy components/agents/file-diff.tsx and its returned support files from the Code tab; preserve the project-relative paths.

Listed package dependencies: clsx, lucide-react, motion, react, shiki, tailwind-merge.

Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.

Let a reviewer inspect proposed file changes before any write occurs

// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
'use client';

import { FileDiff, type FileDiffLine } from '@/components/agents/file-diff';

const lines: FileDiffLine[] = [
  { id: 'old-label', type: 'removed', oldLine: 12, content: '<button>Continue</button>' },
  { id: 'new-label', type: 'added', newLine: 12, content: '<button>Save draft</button>' },
];

export function ProposedLabelChange() {
  return <FileDiff file="button.tsx" lines={lines} status="complete" defaultOpen copyText={'<button>Save draft</button>'} />;
}

Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.

Construct line objects from a trusted diff representation and keep old and new line numbers aligned. Drive complete status from the end of the diff stream.

Customization

FileDiffProps.file
Required; ReactNode.
FileDiffProps.lines
Required; FileDiffLine[].
FileDiffProps.status
Optional; FileDiffStatus.
FileDiffProps.open
Optional; boolean.
FileDiffProps.defaultOpen
Optional; boolean.
FileDiffProps.onOpenChange
Optional; (open: boolean) => void.
FileDiffProps.collapseOnComplete
Optional; boolean.
FileDiffProps.maxHeight
Optional; number.
FileDiffProps.language
Optional; AgentCodeLanguage.
FileDiffProps.copyText
Optional; string.
FileDiffProps.onCopy
Optional; () => void | Promise<void>.
FileDiffProps.className
Optional; string.
AgentCodeProps.code
Required; string.
AgentCodeProps.language
Optional; AgentCodeLanguage.

Integration notes

  • A displayed diff does not apply a patch or authorize a file write.
  • Make it clear whether Copy returns a patch, the proposed file or only selected lines.

Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.

Better with your agent

Give your agent taste.

The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.

All components are free. Sign up only to connect MCP.

Connect to MCP