When to use
- A code review, an AI agent's proposed change, or a config change that needs sign-off with discussion on specific lines.
- When unified and side-by-side views both matter to your readers.
When not to use
- An agent asking to apply a change with no discussion: use Approval Card.
- Prose or contract changes: a word-level redline reads better than lines.
Installation
pnpm dlx shadcn add @eased-pro/pr-reviewnpx shadcn add @eased-pro/pr-reviewyarn dlx shadcn add @eased-pro/pr-reviewbunx --bun shadcn add @eased-pro/pr-reviewNeeds the @eased-pro registry and your Pro token in components.json. Create a token and copy the setup from your account .
Install the dependencies
pnpm add motionnpm install motionyarn add motionbun add motionAdd the Eased pieces it builds on
Copy each item’s files the same way, or install them with the CLI:
Add the files
- components/eased/pr-review/pr-review.tsx
Source is included with Eased Pro. Members download the files with the CLI command above, or through the MCP server.
Keep the folder layout
The files import each other by relative path (
../lib/motion), so keep each one at the path shown, undercomponents/eased/.
Usage
import { lineHunks } from "@/components/eased/_primitives/doc-core/doc-core";import { PRReview } from "@/components/eased/pr-review/pr-review";const hunks = lineHunks(before, after); // outside render: jsdiff reads the clock<PRReview path="src/app/billing/invoice-row.tsx" lang="tsx" before={before} after={after} hunks={hunks} comments={comments} onComment={(anchor, body) => save(anchor, body)} approved={approved} onApprove={() => approve()}/>;API reference
PRReview
| Prop | Type | Default | Description |
|---|---|---|---|
path | string | The file path above the diff. | |
before / after | string | Both versions, for highlighting. | |
hunks | DiffHunk[] | The change, e.g. doc-core lineHunks(before, after). | |
lang | string | Shiki grammar, e.g. "tsx". | |
comments | ReviewComment[] | [] | { id, anchor, author, body, when? }. anchor is n42 (new line 42) or o17 (old line 17). |
onComment | (anchor, body) => void | Enables commenting. | |
mode / defaultMode / onModeChange | "unified" | "split" | "unified" | The diff layout. Under 24rem the toggle hides and the diff stays unified. |
onApprove / approved | () => void / boolean | Shows the hold-to-approve button. | |
holdMs | number | 900 | How long Approve must be held. |
header | ReactNode | Above the file bar: the PR's meta. | |
className | string | "" | Appended to the root. |
Keyboard
| Key | Action |
|---|---|
Tab | Layout toggle, the diff, each line number (opens a comment box), then Approve. |
⌘ / Ctrl + Enter | Posts the comment. |
Esc | Cancels the comment box. |
Hold Space / Enter | Approves once the fill completes. |
Accessibility
- The diff is a named, focusable region; added and removed lines are labelled; line-number buttons are named "Comment on line 11".
- The comment count is a polite live region. Approve is named "Approve: press and hold", then "Approved".
Motion
Switching layouts is a FLIP: every line keeps a shared layout id and glides to its new place on the smooth spring (position only, so text never stretches); context lines' new-side copies fade in. Comment boxes open under their line on Auto Height. Approve fills with brand left to right in linear time while held and drains on the smooth spring if let go early. Reduced motion: lines jump, Auto Height snaps.
Notes for AI
Compute hunks once outside render and keep comments in your own store keyed by anchor. One PRReview shows one file; render several for a multi-file PR.
Don't re-highlight the code or wrap rows in your own motion: the component does both, and extra layout animations will fight its FLIP.
Related components
- AI Agent Approval Card: approve an agent's change without discussion.
- Code Block with Syntax Highlighting: highlighted code with no diff.
- CI Pipeline