Inline Code Diff

A two line code diff showing the removed line in red with a minus and the added line in green with a plus, in monospace. Suits AI edit suggestions.

src/registry/ui/inline-code-diff.tsx/r/inline-code-diff.json

Installation#

bash
npx shadcn@latest add @minidev/inline-code-diff

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/inline-code-diff.json

Usage#

tsx
import { InlineCodeDiff } from "@/components/ui/inline-code-diff"

export function Example() {
  return (
    <InlineCodeDiff before="color: gray" after="color: var(--fg-muted)" />
  )
}

API reference#

InlineCodeDiff props
PropTypeDefault
before*string-
after*string-
classNamestring-

* required

Examples#

All Developer tool UI components for React