shadcn.io is not affiliated with official shadcn/ui
Added Removed Diff List Features Block for React
A unified diff of one config file in a hairline frame, with + and - gutters in foreground weights, one caption beside each hunk, folded runs of unchanged lines that open in place, and a footer counting the changes.
Installation
Overview
A features section for React with Base UI that explains a change to a configuration file. A framed diff, with + marks on its corners, holds a file header, three hunks and a footer. Added lines are drawn strong on a tint and removed lines quiet, each with a plus or minus in its gutter and a hidden "Added" or "Removed" for screen readers, so the meaning never rests on colour. Beside each hunk a caption says what the change does, and runs of unchanged lines are folded into rows ("7 unchanged lines") that open in place and push only what is below. The footer counts additions and removals from the same data. For infrastructure, settings and policy tools where the change is the product. It is a config reader, not a code review.
FAQ
How do I change the diff?
Edit HUNKS at the top of the file: each hunk has a title, a sentence and its lines, and each line is a kind (add, del or ctx) with its text. The folded runs are BEFORE_LINES and BETWEEN_LINES. The counts in the folds, the hunk badge and the footer are worked out from the data, so they cannot drift from the lines.
Why are the lines not green and red?
The block follows your theme and keeps the page's colours for rare states. An added line is drawn in full foreground on a tint, a removed line in the quiet colour, and the gutter carries a plus or minus. Screen readers hear "Added" or "Removed" before each changed line.
How do the folded rows work?
Each is a Collapsible: a button that names how many lines it hides, with the lines in a panel that opens in place with a short height transition. Opening one only moves what is below it, never the lines above, and the button works with Enter and Space and shows a focus ring. The panel animates with a grid-row transition.
Does it follow my theme?
Yes. The frame, tints and text use theme tokens only, so it is light on a light page and dark on a dark one in any preset. There is no button and no Shine Button in this block.
Related
- --++Pro
Split Layout Code Diff Hero
Code and terminalA showcase hero for a code review tool: a centred headline, a Shine Button, a second action and three ticks over a wide pull request window in a hairline frame, with a diff whose changes play out line by line.
- Pro
Pull Request Showcase Hero
Code and terminalA showcase hero for a merge queue: a two-part header with a Shine Button, over a ruled band where a pull request page rises and fades out, with its diff, reviewers, checks and queue position.
- Pro
Alternating Code Block Rows Features
Alternating rowsThree alternating bands for a typed event-stream client, each pairing a sentence with a code window that draws a different artifact: a call with its autocomplete popover, a config file with one line marked, and a command's output.
- Pro
Live Code Playground Showcase Features
App screensA code window in a framed figure with three language tabs, a copy button, and a Run button that shows a spinner and then a typed response panel, for a typed SDK.
- Pro
API Endpoints Features
App screensAn endpoint reference for an e-signature API: six rows with a method, a path, a sentence and a status, each opening to a request and a response snippet.
- Pro
Before After Toggle Features
Live controlsA Before and After control that cross-fades a settings screen between a cluttered version (warning banners, a nested menu, badges everywhere) and a clean one, in a frame that never changes height.