Claude Diff
brainless/claude-diffFreeComponent
An inline edit hunk with tinted +/- rows, line numbers, and off-screen added/removed labels.
Install it
npx shadcn@latest add https://brainless.swerdlow.dev/r/claude-diff.jsonSource
1import * as React from "react";2import { cn } from "@/lib/utils";34/**5 * ClaudeDiff — Claude Code's inline edit hunk (the ⏺ Update / ⎿ summary + the6 * +/- lines). Added/removed rows carry semantic tinted backgrounds and an7 * off-screen "added"/"removed" label so the diff is legible without color.8 */9export type DiffLine = {10 type: "add" | "del" | "ctx";11 n?: number;12 text: string;13};1415const GREEN = "#4ea96f";1617export function ClaudeDiff({18 file,19 summary,20 lines,21 className,22}: {23 file: string;24 summary?: string;25 lines: DiffLine[];26 className?: string;27}) {28 return (29 <div className={cn("min-w-0 font-mono text-[13px] leading-[1.55]", className)}>30 <div className="flex min-w-0 flex-wrap items-baseline gap-x-2">31 <span aria-hidden className="shrink-0" style={{ color: GREEN }}>32 ⏺33 </span>34 <span className="text-[#c0caf5]">Update</span>35 <span className="min-w-0 break-all">36 <span className="text-[#565f89]">(</span>37 <span className="text-[#7dcfff]">{file}</span>38 <span className="text-[#565f89]">)</span>39 </span>40 </div>41 {summary ? (42 <div className="flex min-w-0 items-baseline gap-2 text-[#8b8fa3]">43 {/* invisible status glyph spacer: aligns ⎿ under "Update" */}44 <span aria-hidden className="invisible shrink-0">45 ⏺46 </span>47 <span aria-hidden className="shrink-0" style={{ color: "#565f89" }}>48 ⎿49 </span>50 <span className="min-w-0 break-words">{summary}</span>51 </div>52 ) : null}5354 <pre className="mt-1 min-w-0 overflow-x-auto rounded-none border border-[#202022] bg-[#101010] py-1.5 pl-2 pr-3">55 {lines.map((l, i) => {56 const bg =57 l.type === "add"58 ? "rgba(78, 169, 111,.10)"59 : l.type === "del"60 ? "rgba(247,118,142,.12)"61 : "transparent";62 const mark = l.type === "add" ? "+" : l.type === "del" ? "-" : " ";63 const markColor =64 l.type === "add" ? GREEN : l.type === "del" ? "#f7768e" : "#565f89";65 return (66 <div key={i} className="flex min-w-0" style={{ background: bg }}>67 <span68 className="w-9 shrink-0 select-none pr-2 text-right"69 style={{ color: "#3b3f52" }}70 >71 {l.n ?? ""}72 </span>73// … truncated
Files it writes
More from brainless
All 40 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Claude Headerclaude-header | brainless | Components | Free | no deps | |
| Claude Messageclaude-message | brainless | Components | Free | no deps | |
| Claude Permissionclaude-permission | brainless | Components | Free | no deps | |
| Claude Promptclaude-prompt | brainless | Components | Free | no deps | |
| Claude Slash Menuclaude-slash-menu | brainless | Components | Free | no deps | |
| Claude Thinkingclaude-thinking | brainless | Components | Free | no deps | |
| Claude Todo Listclaude-todo-list | brainless | Components | Free | no deps | |
| Claude Tool Callclaude-tool-call | brainless | Components | Free | no deps |
