BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/retab-ui/extract-viewer-block

Extract Viewer

retab-ui/extract-viewer-block
FreeBlock

Extracted data beside the source PDF, rendered as a JSON form and linked by sources — hover or select a field to highlight where its value came from and scroll the page to it.

Install it

npx shadcn@latest add https://ui.retab.com/r/extract-viewer-block.json

Source

registry/new-york-v4/blocks/extract-viewer-block.tsxui.retab.com/r/extract-viewer-block.json
1"use client";
2
3import type { JSONSchema7 } from "json-schema";
4import { useForm } from "react-hook-form";
5
6import type { Source } from "@/lib/document-source";
7import {
8 FileViewerContent,
9 FileViewerHeader,
10 FileViewer,
11 FileViewerProvider,
12 FileViewerSidebar,
13 FileViewerSidebarContent,
14 FileViewerSidebarSection,
15 FileViewerSidebarSectionContent,
16 FileViewerSidebarSectionHeader,
17 FileViewerSidebarSectionTitle,
18 FileViewerSidebarTrigger,
19 FileViewerInset,
20 FileViewerViewport,
21} from "@/components/ui/file-viewer";
22import {
23 PdfViewerPages,
24 PdfViewerProvider,
25 type PdfDocumentSource,
26} from "@/components/ui/pdf-viewer";
27import {
28 SegmentedDocumentProvider,
29 useSegmentedDocumentViewport,
30} from "@/components/ui/segmented-document-provider";
31import { useSegmentedSourceFieldLink } from "@/components/ui/source-field-link";
32import { SourceIndicator } from "@/components/ui/source-indicator";
33import { createSourcesSegmentedDocumentModel } from "@/components/ui/source-segmented-document-model";
34import {
35 useSegmentedPdfSourceOverlay,
36 useSegmentedPdfViewerHandle,
37} from "@/components/ui/source-segmented-document-overlays";
38import { JsonForm } from "@/components/json-form/json-form";
39import extractSample from "@/components/viewers/sample-data/extract.json";
40
41const PDF_URL = "/samples/jane-doe-bank-statement-5-pages.pdf";
42
43type ExtractField = {
44 key: string;
45 label: string;
46 value: string;
47 /** Where this value was found in the document (its source). */
48 source: Source;
49};
50
51// Extracted values from the bank-statement sample with true text coordinates
52// (normalized pdf_bbox anchors), so each field's source highlight lands on the page.
53const FIELDS = extractSample as ExtractField[];
54const schema: JSONSchema7 = {
55 type: "object",
56 properties: Object.fromEntries(
57 FIELDS.map((field) => [
58 field.key,
59 {
60 type: "string",
61 title: field.label,
62 },
63 ]),
64 ),
65};
66const defaultValues = Object.fromEntries(
67 FIELDS.map((field) => [field.key, field.value]),
68) as Record<string, unknown>;
69const PDF_SOURCE: PdfDocumentSource = {
70 kind: "url",
71 url: PDF_URL,
72 fileName: "jane-doe-bank-statement-5-pages.pdf",
73};
74const SOURCE_FIELDS = FIELDS.map((field) => ({
75 id: field.key,
76 label: field.label,
77 source: field.source,
78}));
79const SEGMENTED_DOCUMENT = createSourcesSegmentedDocumentModel(SOURCE_FIELDS);
80
81/**
82 * Extract viewer block — extracted fields beside the source document, linked by
83// … truncated

What it pulls in

npm packages

  • react-hook-form
  • @radix-ui/react-checkbox@^1.1.3
  • @radix-ui/react-label@^2.1.1
  • @radix-ui/react-slot@^1.1.1
  • lucide-react@^0.460.0

Other registry items

  • @retab/file-viewer
  • @retab/pdf-viewer
  • @retab/document-source
  • @retab/scroll-area
  • @retab/segmented-document
  • @retab/source-segmented-document
  • @retab/utils
  • @retab/source-field-link
  • @retab/source-indicator
  • @retab/data-cell
  • @retab/input
  • tooltip

Files it writes

  • registry/new-york-v4/blocks/extract-viewer-block.tsx
  • components/viewers/sample-data/extract.json
  • components/json-form/array-fields.tsx
  • components/json-form/disclosure.tsx
  • components/json-form/field-renderer.ts
  • components/json-form/form-primitives.tsx
  • components/json-form/json-form-constants.ts
  • components/json-form/json-form.tsx
  • components/json-form/object-fields.tsx
  • components/json-form/open-paths.tsx
  • components/json-form/path-codec.ts
  • components/json-form/scalar-control.tsx
  • components/json-form/scalar/boolean-control.tsx
  • components/json-form/scalar/date-time-control.tsx
  • components/json-form/scalar/enum-control.tsx
  • components/json-form/scalar/number-control.tsx
  • components/json-form/scalar/text-control.tsx
  • components/json-form/scalar/types.ts
  • components/json-form/schema-model.ts
  • components/json-form/source-link-table-hover.ts
  • components/json-form/source-link.tsx
  • components/json-form/table/array-table-body.tsx
  • components/json-form/table/array-table-cell-commit.ts
  • components/json-form/table/array-table-cell-model.ts
  • components/json-form/table/array-table-cell-props.ts
  • components/json-form/table/array-table-cell.tsx
  • components/json-form/table/array-table-config.ts
  • components/json-form/table/array-table-format.ts
  • components/json-form/table/array-table-row.tsx
  • components/json-form/table/array-table-scroll.ts
  • components/json-form/table/array-table.tsx
  • components/json-form/virtual-list.tsx
  • registry/new-york-v4/ui/measured-row-virtualization.ts
  • components/json-form/table/array-table-active-cell-store.ts
  • components/json-form/table/array-table-data-cell-props.ts
  • components/json-form/source-link-focus-intent.ts

Facts

Registry
retab-ui
Type
registry:block
Access
Free
Files written
36
Licence
NOASSERTION
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

ui.retab.com retab-dev/retab-ui on GitHub Raw registry item This item as JSON

More from retab-ui

All 130 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Classify Consensusclassify-consensus-viewer-blockretab-uiBlocksFree1 dep · 4 files
CSV Sourcescsv-sources-blockretab-uiBlocksFreeno deps · 2 files
DOCX Sourcesdocx-sources-blockretab-uiBlocksFreeno deps · 2 files
Avatar Image Slotdropzone-avatar-image-slotretab-uiBlocksFree1 dep · 2 files
Dropzonedropzone-blockretab-uiBlocksFree1 dep · 26 files
Comparison Pairdropzone-comparison-pair-uploadretab-uiBlocksFree1 dep · 2 files
Controlled Queuedropzone-controlled-queueretab-uiBlocksFree1 dep · 2 files
Custom Thumbnail Griddropzone-custom-thumbnail-gridretab-uiBlocksFree1 dep · 2 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex