Typed fields read from a document, each linked to where it came from. A viewer on the left, Fields, JSON and Schema on the right. Values stream in with a confidence, hovering one lights its box on the page and the other way round, and anything doubtful is flagged with a reason and a confirm or edit step before Accept all.
Examples
Your own viewer
Error and retry
Installation
Installation is part of Pro
Pro components install from a licensed registry. The live preview stays open to everyone.
Props
- documentrequired
{ name, pages? }- The document: its name for the header and the number of pages (default 1).
- schemarequired
{ fields: FieldDef[] }- What to read. A field is { id, label, kind, required?, columns? } with kind text, date, amount, code, id or table. id is an IBAN-like value and gets its check digits tested; a table takes columns.
- extractrequired
(doc, schema, signal) => AsyncIterable<ExtractEvent>- Your model call. Yield { path, value, confidence, source?, reason? } as each value is read: path is the field id, or table.row.column such as items.0.total; confidence is 0 to 1; source is { page, x, y, w, h } normalised to the page. Yield { usage: { cost } } for the footer. Honour signal. Throw to show the error state.
- renderPage
(page) => ReactNode- The page content. We draw it at pageAspect and put the highlight layer over it. The demo renders plain HTML, so no PDF library is needed.
- renderViewer
({ page, pages, overlay }) => ReactNode- Replace the whole viewer with your own (a PDF viewer, an image). Put overlay inside your page element, which needs position: relative; the boxes use fixed colours that read on a white page.
- threshold
number- Default
0.85 - A value below this is flagged. A reason from your model, or a failed check such as a bad date or IBAN, also flags it.
- checks
(state) => Record<path, reason>- Checks across values, run when the extraction finishes. totalMatchesRows(table, column, total) is included: it flags a total that does not equal the sum of the rows.
- onAccept / onChange
(record) => void- The typed record: amounts as numbers, dates as ISO, tables as arrays of rows. onAccept runs on Accept all; onChange on a confirm or an edit and when a run ends.
- model / currency / pageAspect
string / string / number- Default
- / USD / 0.77 - Neutral footer text, the currency used to show amounts, and the page width over height.
- Keyboard
Tab, Enter, Esc- Tab moves through the fields and their Confirm and Edit buttons; focusing a value lights its box. Review moves to the next flagged field. In an edit, Enter saves and Esc cancels. Esc elsewhere stops a running extraction.
- Motion
arrival- A new value rises in over 180 ms. Reduced motion shows it at once. Status is a coloured icon plus words, never colour alone, and progress is announced in a polite live region.
| Prop | Type | Default | Description |
|---|---|---|---|
| documentrequired | { name, pages? } | required | The document: its name for the header and the number of pages (default 1). |
| schemarequired | { fields: FieldDef[] } | required | What to read. A field is { id, label, kind, required?, columns? } with kind text, date, amount, code, id or table. id is an IBAN-like value and gets its check digits tested; a table takes columns. |
| extractrequired | (doc, schema, signal) => AsyncIterable<ExtractEvent> | required | Your model call. Yield { path, value, confidence, source?, reason? } as each value is read: path is the field id, or table.row.column such as items.0.total; confidence is 0 to 1; source is { page, x, y, w, h } normalised to the page. Yield { usage: { cost } } for the footer. Honour signal. Throw to show the error state. |
| renderPage | (page) => ReactNode | - | The page content. We draw it at pageAspect and put the highlight layer over it. The demo renders plain HTML, so no PDF library is needed. |
| renderViewer | ({ page, pages, overlay }) => ReactNode | - | Replace the whole viewer with your own (a PDF viewer, an image). Put overlay inside your page element, which needs position: relative; the boxes use fixed colours that read on a white page. |
| threshold | number | 0.85 | A value below this is flagged. A reason from your model, or a failed check such as a bad date or IBAN, also flags it. |
| checks | (state) => Record<path, reason> | - | Checks across values, run when the extraction finishes. totalMatchesRows(table, column, total) is included: it flags a total that does not equal the sum of the rows. |
| onAccept / onChange | (record) => void | - | The typed record: amounts as numbers, dates as ISO, tables as arrays of rows. onAccept runs on Accept all; onChange on a confirm or an edit and when a run ends. |
| model / currency / pageAspect | string / string / number | - / USD / 0.77 | Neutral footer text, the currency used to show amounts, and the page width over height. |
| Keyboard | Tab, Enter, Esc | - | Tab moves through the fields and their Confirm and Edit buttons; focusing a value lights its box. Review moves to the next flagged field. In an edit, Enter saves and Esc cancels. Esc elsewhere stops a running extraction. |
| Motion | arrival | - | A new value rises in over 180 ms. Reduced motion shows it at once. Status is a coloured icon plus words, never colour alone, and progress is announced in a polite live region. |
When to use
When to use
- Turning invoices, forms or contracts into typed fields where a person must be able to check each value against the page.
- A review queue for model output: the doubtful values are flagged with a reason and a person confirms or fixes them before anything is saved.
When not to use
- Showing where an AI answer got its facts from: use Grounded Answer.
- A plain table of records with sorting and filters: use Data Table.
- Following the steps of one agent run: use Trace Waterfall.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Document Extract to my app and wire it to my own data.
- I need turning invoices, forms or contracts into typed fields where a person must be able to check each value against the page. Set that up with the Knowns UI Document Extract.
- Which Document Extract props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "document-extract" }) and search_docs({ query: "document extract" }). Pro props, full examples and source come back once your license key is in the MCP config.