CodeDiff

Markdown

Code changes, inline or side by side, with line numbers and clear size limits.

Used in Coding Studio.

Use it for
Unified or split comparison of code.
Not for
Comparing artifact versions. Try ArtifactDiff.

CodeDiff preview

Loading example…

Installation

npm install @stackunseen/ui
import { CodeDiff } from '@stackunseen/ui';
Styles: @stackunseen/ui/styles.css

Usage and props

Pass the before and after text and whether it can be read. Copying never changes files; applying a patch is up to your app. For syntax colors, use HighlightedCodeDiff from the /highlight entry.

Supported inputs

This is the public signature used by this example. Open Code to see how the values and callbacks fit together.

path · before · after · baseVersion · nextVersion · status? · error? · copyable? · renderLine?
How state and callbacks work
All props

Loading…

For your coding agent

Give the agent this page instead of a screenshot. The prompt wraps the page with the install and import lines and the rule that your server, not a click, completes an action.

Contract
path · before · after · baseVersion · nextVersion · status? · error? · copyable? · renderLine?
Keeps honest
Pass the before and after text and whether it can be read. Copying never changes files; applying a patch is up to your app. For syntax colors, use HighlightedCodeDiff from the /highlight entry.
MCP
read_component "CodeDiff" on the docs endpoint
Open the Markdown file

Keyboard and customization

Keyboard

Tab reaches controls; Enter or Space activates buttons. Accordions use arrow keys, Home and End. Select menus support arrows and typeahead; Escape closes menus and dialogs and restores focus.

Customization

Change shared colors, spacing, corners and icons with the theme. Use the component's supported props to adapt its content and layout. Customization guide and Theme Studio