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/layout-blocks

Layout Blocks

retab-ui/layout-blocks
FreeComponent

A provider-agnostic layout inspection component for OCR output: normalize Google Document AI, AWS Textract, or Azure Document Intelligence into shared blocks, lines, and words, then review them over the source page with virtualized rows, confidence filtering, and precise overlays.

Install it

npx shadcn@latest add https://ui.retab.com/r/layout-blocks.json

Source

registry/new-york-v4/ui/layout-blocks.tsxui.retab.com/r/layout-blocks.json · first 6 KB
1"use client";
2
3import * as React from "react";
4
5import { cn } from "@/lib/utils";
6import {
7 FileViewer,
8 FileViewerContent,
9 FileViewerProvider,
10 FileViewerInset,
11 FileViewerSidebar,
12 FileViewerSidebarTrigger,
13 FileViewerViewport,
14} from "@/components/ui/file-viewer";
15import {
16 PdfViewerPages,
17 PdfViewerProvider,
18 type PdfDocumentSource,
19 type PdfViewerHandle,
20} from "@/components/ui/pdf-viewer";
21import {
22 SegmentedDocumentProvider,
23 useSegmentedDocumentViewport,
24} from "@/components/ui/segmented-document-provider";
25import { useSegmentedItemLink } from "@/components/ui/segmented-item-link";
26import {
27 ViewerHeader,
28 ViewerRoot,
29 ViewerSidebarTrigger,
30} from "@/components/ui/viewer";
31
32import {
33 azureToLayoutDocument,
34 type AzureDocument,
35} from "./layout-blocks-azure";
36import {
37 documentAiPageImages,
38 documentAiToLayoutDocument,
39 type DocumentAiDocument,
40} from "./layout-blocks-document-ai";
41import { createLayoutBlocksViewerModel } from "./layout-blocks-model";
42import { LayoutBlocksPanel } from "./layout-blocks-panel";
43import { layoutDocumentToPdfBlob } from "./layout-blocks-pdf";
44import { createOcrSegmentedDocumentModel } from "./layout-blocks-segmented-document-model";
45import {
46 textractToLayoutDocument,
47 type TextractDocument,
48} from "./layout-blocks-textract";
49import type { LayoutDocument, LayoutLevel } from "./layout-blocks-types";
50import { LayoutOverlayLayer } from "./layout-overlay-layer";
51import { useKeyedMountEffect } from "@/hooks/use-keyed-mount-effect";
52import { joinEffectKey } from "@/lib/effect-key";
53
54const LOW_CONFIDENCE_THRESHOLD = 0.9;
55const LEVEL_ORDER: LayoutLevel[] = ["block", "paragraph", "line", "word"];
56const EMPTY_PAGE_IMAGES: ReadonlyMap<number, string> = new Map();
57
58/**
59 * Discriminated source for the OCR viewer. Each provider's raw output is
60 * normalized to a shared {@link LayoutDocument} before rendering, so the viewer
61 * itself is provider-agnostic.
62 */
63export type OcrSource =
64 | {
65 provider: "google-document-ai";
66 output: DocumentAiDocument;
67 pageImages?: ReadonlyMap<number, string>;
68 }
69 | {
70 provider: "aws-textract";
71 output: TextractDocument;
72 pageImages?: ReadonlyMap<number, string>;
73 }
74 | {
75 provider: "azure-document-intelligence";
76 output: AzureDocument;
77 pageImages?: ReadonlyMap<number, string>;
78 };
79
80export function OcrLayoutBlocks({
81 className,
82 heightClassName = "h-[680px]",
83 source,
84}: {
85 className?: string;
86 heightClassName?: string;
87// … truncated

What it pulls in

Other registry items

  • @retab/document-evidence
  • @retab/file-viewer
  • @retab/interactive-item-list
  • @retab/pdf-viewer
  • @retab/scroll-area
  • @retab/segmented-document
  • @retab/utils

Files it writes

  • registry/new-york-v4/ui/layout-blocks.tsx
  • registry/new-york-v4/ui/layout-blocks-types.ts
  • registry/new-york-v4/ui/layout-blocks-document-ai.ts
  • registry/new-york-v4/ui/layout-blocks-document-ai-pdf.ts
  • registry/new-york-v4/ui/layout-blocks-textract.ts
  • registry/new-york-v4/ui/layout-blocks-azure.ts
  • registry/new-york-v4/ui/layout-blocks-pdf.ts
  • registry/new-york-v4/ui/layout-blocks-geometry.ts
  • registry/new-york-v4/ui/layout-blocks-index.ts
  • registry/new-york-v4/ui/layout-blocks-model.ts
  • registry/new-york-v4/ui/layout-blocks-segmented-document-model.ts
  • registry/new-york-v4/ui/layout-overlay-layer.tsx
  • registry/new-york-v4/ui/layout-blocks-panel.tsx

Facts

Registry
retab-ui
Type
registry:ui
Access
Free
Files written
13
Licence
NOASSERTION
First indexed
2026-08-04
Last confirmed
today

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
Alertalertretab-uiComponentsFree1 dep
Alert Dialogalert-dialogretab-uiComponentsFree1 dep
Aspect Ratioaspect-ratioretab-uiComponentsFreeno deps
Attachment Sidebarattachment-sidebarretab-uiComponentsFree1 dep
Autocompleteautocompleteretab-uiComponentsFree2 deps
Calendarcalendarretab-uiComponentsFree2 deps
Code Viewercode-viewerretab-uiComponentsFree2 deps · 32 files
Commandcommandretab-uiComponentsFree2 deps
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