BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fredrika ui/diff-viewer

Diff Viewer

fredrika-ui/diff-viewer
FreeComponent

A diff viewer component

Install it

npx shadcn@latest add https://ui.fredrika.dev/r/diff-viewer.json

Source

registry/blocks/diff-viewer/diff-viewer.tsxui.fredrika.dev/r/diff-viewer.json
1import { Diff, Hunk } from "@/registry/ui/diff";
2
3import {
4 CollapsibleCard,
5 CollapsibleCardHeader,
6 CollapsibleCardTitle,
7 CollapsibleCardContent,
8} from "@/registry/ui/collapsible-card";
9
10import { parseDiff, ParseOptions } from "@/registry/ui/diff/utils/parse";
11
12export function DiffViewer({
13 patch,
14 options = {},
15}: {
16 patch: string;
17 options?: Partial<ParseOptions>;
18}) {
19 const [file] = parseDiff(patch, options);
20
21 return (
22 <CollapsibleCard
23 data-section-id="diff-viewer"
24 id="diff-viewer"
25 className="my-4 text-[0.8rem] w-full"
26 title="File Changes"
27 defaultOpen
28 >
29 <CollapsibleCardHeader>
30 <CollapsibleCardTitle title={file.newPath}>
31 {file.newPath}
32 </CollapsibleCardTitle>
33 </CollapsibleCardHeader>
34 <CollapsibleCardContent>
35 <Diff fileName="file-changes.tsx" hunks={file.hunks} type={file.type}>
36 {file.hunks.map((hunk) => (
37 <Hunk key={hunk.content} hunk={hunk} />
38 ))}
39 </Diff>
40 </CollapsibleCardContent>
41 </CollapsibleCard>
42 );
43}

What it pulls in

npm packages

  • refractor
  • lucide-react
  • gitdiff-parser
  • diff

Other registry items

  • button
  • https://ui.fredrika.dev/r/collapsible-card.json

Files it writes

  • registry/ui/diff/index.tsx
  • registry/ui/diff/theme.css
  • registry/ui/diff/utils/index.ts
  • registry/ui/diff/utils/parse.ts
  • registry/ui/diff/utils/guess-lang.ts
  • registry/blocks/diff-viewer/page.tsx
  • registry/blocks/diff-viewer/diff-viewer.tsx

Facts

Registry
fredrika ui
Type
registry:component
Access
Free
Files written
7
Licence
MIT
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

ui.fredrika.dev fredrikalindh/ui on GitHub Raw registry item This item as JSON

More from fredrika ui

All 4 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Buttonbuttonfredrika uiComponentsFree2 deps
Collapsible Cardcollapsible-cardfredrika uiComponentsFree2 deps · 5 files
Copy Buttoncopy-buttonfredrika uiComponentsFree1 dep · 2 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex