Extend UI Svelte

Docs / Data and layout / Bounding Box Citations

Bounding Box Citations

Review extracted values against source bounding box citations with form fields and JSON diffing.

Bounding Box Citations provides field-level cards for comparing extracted values with source PDF bounding boxes. Use it when reviewers need to inspect citations, correct values, and optionally compare against expected output.

Statement period
statement_period
string

Date range covered by the bank statement.

Actual
Jan 1-31, 2026
Expected
Transactions
transactions
array
Ending balance
ending_balance
number

Final account balance at the end of the statement period.

Actual
12840.18
Expected
Overdraft protection enabled
overdraft_protection_enabled
boolean

Whether overdraft protection is enabled for the account.

Actual
false
Expected
Account details
account_details
object
Properties 5 fields
Holder name
account_details.holder_name
string
Actual
Jordan Lee
Expected
Account last four
account_details.account_last_four
string
Actual
4821
Expected
Account type
account_details.account_type
string
Actual
Checking
Expected
Mailing address
account_details.mailing_address
object
Properties 3 fields
Line 1
account_details.mailing_address.line_1
string
Actual
42 Market Street
Expected
City
account_details.mailing_address.city
string
Actual
Brooklyn
Expected
State
account_details.mailing_address.state
string
Actual
NY
Expected
Linked accounts
account_details.linked_accounts
array

Bounding Box Citations block

The panel composed with the PDF Viewer: focusing a field highlights its bounding box and scrolls the page there; hovering a transaction row highlights its line; clicking a box focuses its field. The sample bank statement and its citations are upstream's block demo data (extend-hq/ui, MIT).

Loading PDF…

Active citation: none

Useful behaviors

  • Actual and expected values displayed side by side for each schema field when showExpected is enabled.
  • Array values rendered as grids, including drill-down for nested arrays and objects, with the Actual and Expected grids kept in sync.
  • Input controls selected from the JSON schema property type.
  • Object schema properties rendered as nested cards in the scrollable form.
  • Per-field undo and Set to NULL actions when showExpected is enabled.
  • Form and JSON diff views for the same reviewed output state when showExpected is enabled.

API Reference

HumanReviewPanel

PropTypeDefault
fieldsReviewField[]sample fields
bind:valuesJsonObjecteach field's expected
activeFieldKeystring-
class / classNamestring-
onFieldFocus(field: ReviewField) => void-
onLocationHover(location?: ReviewLocation) => void-
resolveLocation(metadataPath: string) => ReviewLocation | undefined-
resolveArrayItemMetadataPath(path, rowIndex, rowValue) => string | undefined-
showExpectedbooleantrue
isDark / onIsDarkChangeboolean / (isDark: boolean) => voidfalse

ReviewField

PropTypeRequired
keystringYes
schemaReviewFieldSchemaYes
actualJsonValueYes
expectedJsonValueYes
location{ page: number; area: HighlightArea }No

Differences from upstream

  • theme is replaced by parent-controlled isDark + onIsDarkChange; neither component renders its own theme control.
  • class and className are both accepted and merged.
  • Array grids are a Svelte DOM table instead of glide-data-grid: same columns, row numbers, double-click / Enter / typing to edit, drill-in and mirrored selection, but single-cell selection only (no range or drag selection). No #portal element is needed.
  • The JSON diff is a built-in line diff instead of @pierre/diffs: split view with collapsed unchanged lines, no word-level highlights.
  • Added bind:values on the panel to read the edited output (upstream keeps it internal although its usage sample passes values).
  • Panel height comes from the --human-review-panel-height CSS variable (default 560px) instead of a className height utility.
  • Block (HumanReviewBlock, exported also as BoundingBoxCitations): every located field gets a faint clickable box, so clicking a box focuses its field (upstream draws only the active box).
  • Block: src is the primary PDF prop and upstream's file is an alias; added bind:activeFieldKey, onActiveFieldChange, onFieldFocus, onLocationHover, bind:values, fileName, and height.
  • Block: the PDF renders on the shared PdfViewer; scroll-to-area is computed from the rendered page slots because PdfViewer has no scrollToPageArea handle.
  • Block: the resizable split stacks vertically below 900px instead of switching to a vertical resizable layout.
  • Port-only exports: the overlay helpers boxesForPage, formatCitationValue, getCitationLocation, plus the types BoundingBoxCitationsProps, HumanReviewPanelProps, CitationBox, ArrayNestedView, ArrayReviewSide. Upstream's HumanReviewTheme type is not exported because theme is replaced by isDark.

Back to all components