Document review
A React block (a whole screen) in Beamline's Government & legal app.
A PDF going through review: the document in the viewer with every comment pinned to its place, the reviewers' threads beside it (open or resolved, one opened at a time with its replies), what changed since the last version with each change marked in the page, a version switcher, and Approve or Request changes with a reason, both sent to your API and refused with the reason.
Use it for
- Contracts, statements of work, policies or invoices that several people comment on and approve before they are signed or paid.
- Any review where a decision (approve, or ask for changes with a reason) is made on a specific version of a document.
Not for
- Reading one document without a review (document-viewer).
- Reviewing code or text changes line by line (file-diff).
- Approving an agent's proposed action (approval-card).
Anatomy
- header: the document's name and reference, its state (In review · Changes requested · Approved, each a word, a glyph and a tone), the version switcher, the reviewers' faces with how many approved, Request changes and Approve
- decision popover: a reason (required to ask for changes, optional to approve), what is still open, Send; working, done or refused with the reason
- document: the document viewer with each thread's annotation and, on Changes, each change marked in the page
- side panel, tabs: Comments (count open) · Changes (count) · Reviewers
- Comments: Open · Resolved · All; each thread folded to one line (its pin, page, passage and first comment) and the chosen one open with its replies, Resolve and a reply field
- Changes: this version against the one before, each change with its kind (added, changed, removed: a glyph and a word), its section and page, before struck through and after, the changed words marked
- Reviewers: each person, their decision and reason and when
Variants
- 0: the latest version (decisions on) or an earlier one (read-only, with a way back to the latest)
States
- in review · changes requested · approved
- reading an earlier version
- a new comment being written (from Comment in the viewer, its thread opens with the field ready)
- no comments yet · no open comments · first version (nothing to compare)
- decision sending (both decision controls are unavailable until the request settles), sent, refused (the decision steps back and the reason shows with Try again)
- narrow room (phone): the panel opens as a sheet from the header's button
Keyboard
- Tabs and the filter move with the arrows
- A thread's line is a button: Enter opens it and the document jumps to its place
- In a decision: ⌘Enter sends, Escape closes
- Everything in the document viewer (pages, zoom, search, Highlight this hit)
Motion
Choosing a thread or a change glides the document to it and lights the place once; the chosen thread unfolds in place and the one before folds (.disclosure-panel), threads move to their new places when filtered (useFlip); the state badge eases to its new tone and the count of approvals rolls; a sent decision morphs its button from working to done. Nothing moves at rest.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
document (required) | { title: string; reference?: string } | — | What is under review. |
versions (required) | ReviewVersion[] | — | Oldest first. |
version / defaultVersion / onVersionChange | string | — | The version shown; the latest by default. |
threads / defaultThreads / onThreadsChange | ReviewThread[] | — | { id, versionId, annotation, comments, resolved }: a comment thread pinned to a place in one version. New ones come from the viewer's Highlight and Comment. |
reviewers / defaultReviewers / onReviewersChange | ReviewerDecision[] | — | { person, decision: approved · changes-requested · null, reason?, at? } for the latest version. |
currentUser (required) | { id, name, avatar? } | — | Who is reviewing: their comments, their decision. |
people | { id, name, avatar? }[] | — | Who can be |
onDecision | ({ versionId, decision, reason }) => Promise<void> | void | — | Approve or Request changes. Shown at once; a rejection puts it back and shows why. Both decision controls wait for the pending request to settle before accepting another decision. |
workerSrc | string | — | Passed to the document viewer (pdf.js's worker). |
className / style / ref | string / CSSProperties / Ref<HTMLDivElement> | — | className: Classes on the documented visual root; no override by default. style: Inline styles on the documented visual root; no overrides by default. ref: Receives the documented native target or imperative handle; omitted by default. |
version | string | — | |
defaultVersion | string | — | |
onVersionChange | ((id: string) => void) | — | |
threads | ReviewThread[] | — | |
defaultThreads | ReviewThread[] | — | |
onThreadsChange | ((threads: ReviewThread[]) => void) | — | |
reviewers | ReviewerDecision[] | — | |
defaultReviewers | ReviewerDecision[] | — | |
onReviewersChange | ((reviewers: ReviewerDecision[]) => void) | — | |
className | string | — | Classes on the documented visual root; no override by default. |
style | CSSProperties | — | Inline styles on the documented visual root; no overrides by default. |
ref | Ref<HTMLDivElement> | — | Receives the documented native target or imperative handle; omitted by default. |
Built from
- document-viewer
- comment-thread
- segmented-control
- tabs
- select
- popover
- textarea
- button
- badge
- avatar
- avatar-group
- alert
- bottom-sheet
- empty-state
- switch
Dependencies
pdfjs-dist, lucide-react
Import
import { DocumentReview } from "@beamline/document-review";
Get it
Document review is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent
More in Government & legal
- Permit application: A permit application filled in over several sittings on a city's portal. Steps with how many answers each still misses; the draft saved as you go and…
- Permit services: Where a permit starts on a city's permitting portal. The work's address resolved to the city (its permits are here) or the county around it (that office…
- Permit fees: An applicant's permit fees on a city's portal. What's owed across how many permits and how much of it is overdue; every unpaid invoice with its permit…
- Permit record: A submitted permit seen by the applicant. The overview leads with what's waiting on them: the corrections to answer before the next version goes in, each…
- Parcel record: A property's parcel on a permitting portal. The lot drawn to scale as a site plan: the street, the property lines with their lengths, the dashed setback…
- Signing request: A document sent for signature, its signature page drawn in miniature with each side's block in order. Sides sign as numbered stages that move earlier or…
- Playbook check: A document's changes checked against a versioned playbook (a rulebook of what's acceptable). Each change shows what it was and is now, then two records…
- Audit room: A compliance audit seen by the company preparing it or by the auditor reviewing it. Evidence keeps the company's readiness (not ready, flagged, ready for…
- Agency book: An insurance agency's book in two places. Estimated commission: the report named an estimate (not received or earned), as of a time; each source system…
- Applicant company: A contractor's company on a permitting portal. Its identity with the licence and insurance it applies under, each said valid, expiring within 60 days…
- Applicant projects: An applicant's permits on a city's portal in one place. Projects through saved views (theirs, their company's, expiring within 30 days) and a search…
- Lease renewals: Leases coming up for renewal. The window leads: every tracked lease placed on the days ahead at its end date, coloured by whose step it is (yours, the…
- Queue display: The screen in a waiting room, read from across the room. It draws only a public projection of the queue (ticket codes and counters, never a name or a…
- Visitor journey: A visitor's way into a walk-in queue, on their phone. Branches first: each card names its address, whether it's open (until when, closing soon, full, or…