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/csv-sources-block

CSV Sources

retab-ui/csv-sources-block
FreeBlock

Extracted values linked to spreadsheet cells — hover to highlight a cell and scroll to it.

Install it

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

Source

registry/new-york-v4/blocks/csv-sources-block.tsxui.retab.com/r/csv-sources-block.json
1"use client";
2
3import * as React from "react";
4
5import type { Source } from "@/lib/document-source";
6import {
7 sourceToCsvCell,
8 useCsvSourceTarget,
9} from "@/components/ui/csv-source";
10import {
11 CsvViewerDocument,
12 type CsvViewerHandle,
13} from "@/components/ui/csv-viewer";
14import {
15 FileViewer,
16 FileViewerContent,
17 FileViewerHeader,
18 FileViewerTitle,
19 FileViewerProvider,
20 FileViewerSidebar,
21 FileViewerSidebarContent,
22 FileViewerInset,
23 FileViewerControls,
24 FileViewerViewport,
25} from "@/components/ui/file-viewer";
26import { SegmentedDocumentProvider } from "@/components/ui/segmented-document-provider";
27import { useSegmentedSourceFieldLink } from "@/components/ui/source-field-link";
28import {
29 SourceFieldList,
30 type SourceField,
31} from "@/components/ui/source-field-list";
32import { createSourcesSegmentedDocumentModel } from "@/components/ui/source-segmented-document-model";
33import csvSample from "@/components/viewers/sample-data/csv-sources.json";
34
35const CSV_TEXT = `region,quarter,revenue,customers,nrr
36North America,Q1,1240000,48,1.12
37North America,Q2,1510000,61,1.21
38EMEA,Q1,820000,33,1.08
39EMEA,Q2,910000,39,1.15
40APAC,Q1,430000,18,1.04
41APAC,Q2,560000,24,1.11`;
42const CSV_SOURCE = {
43 kind: "text" as const,
44 text: CSV_TEXT,
45 fileName: "sales.csv",
46};
47
48type CsvField = SourceField & { source: Source };
49
50const FIELDS = (csvSample as CsvField[]).map((field) => ({
51 ...field,
52 hint:
53 field.source.anchor.kind === "csv_cell"
54 ? `Cell ${field.source.anchor.coordinate ?? field.source.anchor.column}`
55 : undefined,
56}));
57const FIELD_BY_KEY = new Map(FIELDS.map((field) => [field.key, field]));
58const SEGMENTED_DOCUMENT = createSourcesSegmentedDocumentModel(
59 FIELDS.map((field) => ({
60 id: field.key,
61 label: field.label,
62 source: field.source,
63 })),
64);
65
66/**
67 * CSV sources block — extracted values linked to the spreadsheet cells they came
68 * from. Hovering a field highlights its cell and scrolls to it. Segmented
69 * source interaction owns preview/selection while the CSV source adapter owns
70 * cell navigation.
71 */
72export function CsvSourcesBlock() {
73 const viewerRef = React.useRef<CsvViewerHandle>(null);
74
75 return (
76 <SegmentedDocumentProvider model={SEGMENTED_DOCUMENT}>
77 <CsvSourcesContent viewerRef={viewerRef} />
78 </SegmentedDocumentProvider>
79 );
80}
81
82function CsvSourcesContent({
83 viewerRef,
84}: {
85 viewerRef: React.RefObject<CsvViewerHandle | null>;
86}) {
87 const target = useCsvSourceTarget(viewerRef);
88// … truncated

What it pulls in

Other registry items

  • @retab/csv-viewer
  • @retab/csv-source
  • @retab/document-source
  • @retab/segmented-document
  • @retab/source-segmented-document
  • @retab/source-field-list
  • @retab/source-field-link
  • @retab/source-indicator

Files it writes

  • registry/new-york-v4/blocks/csv-sources-block.tsx
  • components/viewers/sample-data/csv-sources.json

Facts

Registry
retab-ui
Type
registry:block
Access
Free
Files written
2
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
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
Disabled Dropzonedropzone-disabled-dropzoneretab-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