InvoiceDocument
A document view for an invoice or a credit note, not a PDF engine: header with status and actions, bill-to and dates, line items, totals and one line about payment.
One page of a document with the values an agent read from it highlighted.
One page with the values an agent read from it highlighted. Not InvoiceDocument. Not RedactionPreview.
Select a highlight to make it active. The issue is the full warning tone, low confidence a softer dashed tint, and each name says so.
DocumentPreview is the page half of a review: pass an image of the page (src) or draw it as children, and give each extracted value a box in percent. Link it to your fields with activeId and onRegionSelect, so focusing a field lights its value and picking a value focuses its field. ReviewQueueScreen uses it this way, with this same sample invoice.
One page of a document with the values an agent read from it highlighted: a toolbar (file name, page of pages, zoom, download) over a scrollable page, and a button per highlighted value. The active highlight, linked to the field being edited beside it, gets a focus ring and aria-pressed. Not a PDF engine: pass an image of the page or draw the page yourself.
import { DocumentPreview } from "agentic-ds-kit";From contracts/documentpreview.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.
| Name | Type | Required | Default | Notes |
|---|---|---|---|---|
| fileName | string | Yes | — | In the toolbar (ellipsis when long, full name in the title), in Download's name ("Download INV-20418.pdf") and in the page region's name. |
| page | number | No | 1 | 1-based page shown. "Page 1 of 1" in the toolbar. |
| pageCount | number | No | 1 | Previous page and Next page IconButtons show when it is more than 1. |
| onPageChange | function | No | — | (page) => void. Previous page and Next page. |
| zoom | number | No | — | Controlled zoom in percent, 50 to 200 in steps of 25. Uncontrolled when left out. |
| defaultZoom | number | No | 100 | Uncontrolled starting zoom. |
| onZoomChange | function | No | — | (zoom) => void. Zoom out and Zoom in (ghost IconButtons); the percent between them is a live output. |
| onDownload | function | No | — | () => void. Shows a Download IconButton at the end of the toolbar. |
| src | string | No | — | An image of the page, contained in the sheet. Leave it out and pass the page as children. |
| alt | string | No | — | With src. Defaults to fileName. |
| children | slot | No | — | The page when there is no src: content laid out in percent of the sheet (position absolute inside it) so the regions line up at every zoom. |
| regions | array | No | — | Boxes in percent of the page (0 to 100, top-left origin). Only the current page's regions show. Each is a button named by label, so say what it is and how sure the agent is ("Show PO number in fields, issue: PO-7782 not found, 61% · Low confidence"). default is neutral (a thin strong line, a faint tint); low is a soft warning tint with a dashed border; issue is the full warning tone, solid and medium, for the value with a problem to fix. Tone is never the only signal: the label says low or issue too. |
| activeId | string | No | — | The region linked to the active field: the strong focus outline and ring over its tone, aria-pressed. null or left out for none. |
| onRegionSelect | function | No | — | (id) => void. A region was clicked or pressed. Move focus to its field from here. |
| loading | boolean | No | false | The toolbar stays; the sheet is a Skeleton that says Loading document; the section is aria-busy. |
| title | string | No | Document preview | Names the section: a visually hidden h2. |
A document view for an invoice or a credit note, not a PDF engine: header with status and actions, bill-to and dates, line items, totals and one line about payment.
Shows exactly what is about to leave the product for a model or outside tool, with sensitive values masked by type and a mask rule per type, before it is sent.
Choose files Button in a dashed drop zone (or a compact Button-only row) plus a list of file rows with progress, done, and error states.
Check what an agent read from a document before it posts.