Docs / Data and layout / Layout Blocks
Layout Blocks
Document layout blocks (headings, paragraphs, tables, figures) with virtualized
scrolling and markdown rendering. Rows size to their content. Dark mode is controlled by the
parent through isDark; the toggle below lives outside the component.
Sample document
Focused block: none
Controlled, parent keeps its block
activeBlockId stays on the heading; the panel still reports each new block once,
like upstream.
Reports: 0
Long document (200 blocks, virtualized)
Differences from upstream
- Exported as
LayoutBlocksand the upstream nameOcrBlocksPanel.classNameandclassare both accepted. Also exported, like upstream:getOcrBlocks,blockToHighlightArea,blockToArea, and the block types. - Port-only exports (upstream keeps these internal or has no equivalent):
DEFAULT_LAYOUT_BLOCKS_HEIGHTandDEFAULT_LAYOUT_BLOCKS_OVERSCAN(defaults for the addedheightandoverscanprops),estimateOcrBlockRowHeight(upstream's internal row size estimate),OCR_BLOCK_TYPE_LABELS(badge text per block type),renderBlockMarkdown(sanitized markdown to HTML), and a default export of the panel. - Not ported: upstream's sample data and demo,
ATTENTION_OCR_OUTPUT(the bundled Attention paper OCR result),PDF_URL(its sample PDF path), and theOcrBlocksdemo that renders the panel from them. - Upstream's
OcrBlockOverlay(the colored block outline drawn on the rendered PDF page) is not ported, so blocks cannot be highlighted on the page yet.blockToAreaandblockToHighlightAreaare exported fromextend-ui-svelte/components/layout-blocksfor building overlays. blockToAreareturns a CSS declaration string (for a Sveltestyleattribute) instead of upstream's React style object.- Adds
height(viewport height, default 420 like upstream) andoverscan(default 6 like upstream) props. - Virtualized with the shared virtual list in measured mode instead of
@tanstack/react-virtual; rows start from upstream's size estimate and then size to their content. - Markdown renders with
markedinstead ofreact-markdown, and type badges are text pills without Hugeicons glyphs. - Click also focuses a block (upstream uses hover and focus only).
- Accepts
isDarkandonIsDarkChange; it reflectsisDarkand never callsonIsDarkChangebecause it renders no theme control.