Rendyn

Component library

189 components

Interaction

Code Comparison

Code Comparison displays two supplied code strings with language and theme settings.

Interactive exampleReact Tailwind CSS

Practical React example

Explain a small before-and-after code change without applying it.

Before you copy and paste

Match the imported component’s client or server rendering boundary before using the example. Copy components/magicui/code-comparison.tsx and its returned support files from the Code tab; preserve the project-relative paths.

Listed package dependencies: next-themes, shiki.

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

Explain a small before-and-after code change without applying it

// Usage adapted from Magic UI's pinned MIT source.
// Copyright (c) Magic UI. See ./LICENSES.md.
'use client';

import { CodeComparison } from '@/components/magicui/code-comparison';

export function LabelComparison() {
  return (
    <CodeComparison
      beforeCode={'<button>Continue</button>'}
      afterCode={'<button>Save draft</button>'}
      language="tsx"
      filename="button.tsx"
      lightTheme="github-light"
      darkTheme="github-dark"
    />
  );
}

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

Keep beforeCode and afterCode tied to the same example and supply the correct filename. Choose themes that are actually supported by the imported highlighting setup.

Customization

CodeComparisonProps.beforeCode
Required; string.
CodeComparisonProps.afterCode
Required; string.
CodeComparisonProps.language
Required; string.
CodeComparisonProps.filename
Required; string.
CodeComparisonProps.lightTheme
Required; string.
CodeComparisonProps.darkTheme
Required; string.
CodeComparisonProps.highlightColor
Optional; string.

Integration notes

  • A colored comparison does not execute, validate or apply either version.
  • Check long lines, keyboard scrolling and whether copied text includes the intended side.

Component source: Magic UI 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