Skip to main content
This page documents all available widget components in the @retab/react package.

DataComponent

Display and edit extracted data in form, table, or code view. Supports real-time streaming during extraction.

Props

PropTypeDefaultDescription
extractionExtraction | nullrequiredThe extraction object to display
onFieldPathChange(fieldPath: string) => void-Callback when a field is focused (for source highlighting)
extractionDisplayOptionsExtractionDisplayOptions-Display configuration options
continueButtonOptionsContinueButtonOptions-Continue/review button configuration
extractionStreamingOptionsExtractionStreamingOptions-Streaming state options

ExtractionDisplayOptions

OptionTypeDefaultDescription
view"form" | "table" | "code""form"Initial view mode
allowEditingbooleanfalseEnable editing of prediction values
showReasoningbooleanfalseShow AI reasoning fields
showTabsbooleanfalseShow tabs to switch between views

Example

DataComponent Example
import { DataComponent, useExtractions } from "@retab/react";

function ExtractionViewer() {
  const { extractions } = useExtractions();
  const extraction = extractions[0];

  return (
    <DataComponent
      extraction={extraction}
      extractionDisplayOptions={{
        view: "form",
        showTabs: true,
        allowEditing: true,
      }}
    />
  );
}

FileComponent

Preview documents with PDF rendering, image zoom, and OCR source highlighting. Supports streaming state for real-time extraction display.

Props

PropTypeDefaultDescription
extractionExtraction | nullrequiredThe extraction containing the file to display
fieldPathstring | nullnullCurrently focused field path (for source highlighting)
extractionStreamingOptionsExtractionStreamingOptions-Streaming state options

Example

FileComponent Example
import { FileComponent, useExtractions } from "@retab/react";
import { useState } from "react";

function DocumentViewer() {
  const { extractions } = useExtractions();
  const [fieldPath, setFieldPath] = useState<string | null>(null);

  return (
    <FileComponent
      extraction={extractions[0]}
      fieldPath={fieldPath}
    />
  );
}

ExtractionsList

Browse and manage extractions with search, filtering, pagination, and thumbnails.

Props

PropTypeDefaultDescription
titlestring-Title displayed in the list header
onSelectExtraction(extraction: Extraction) => void-Callback when an extraction is selected
onNewExtractionClick() => void-Callback when “new extraction” is clicked
visibilityVisibilityOptions-Control which features are visible
initialFiltersFilterType[][]Initial filters to apply

VisibilityOptions

OptionTypeDefaultDescription
searchbooleantrueShow search input
displayPopoverbooleantrueShow display settings popover
statusColumnbooleanfalseShow status column
dateColumnbooleantrueShow date column
filtersbooleanfalseShow filter controls
metadataFilterbooleanfalseShow metadata filter option

Example

ExtractionsList Example
import { ExtractionsList } from "@retab/react";

function ExtractionsPage() {
  const handleSelect = (extraction) => {
    console.log("Selected:", extraction.id);
  };

  return (
    <ExtractionsList
      title="Recent Extractions"
      onSelectExtraction={handleSelect}
      visibility={{
        statusColumn: true,
        dateColumn: true,
        search: true,
        filters: true,
      }}
    />
  );
}

ExtractionReviewer

Complete review interface that combines an extraction list, file preview, and data editor. Ideal for human-in-the-loop workflows.

Props

PropTypeDefaultDescription
projectIdstringrequiredThe project ID to filter extractions
extractionIdstring-Currently selected extraction ID
onNavigate(params: { extractionId?: string }) => voidrequiredCallback for navigation
initialFiltersFilterType[][]Initial filters to apply
visibilityExtractionReviewerVisibilityOptions-Control visibility of features
defaultView"form" | "table" | "code""form"Default view mode

ExtractionReviewerVisibilityOptions

OptionTypeDefaultDescription
searchbooleanfalseShow search input
metadataFilterbooleanfalseShow metadata filter option
filterMenubooleantrueShow filter menu
displayMenubooleantrueShow display settings menu
exportMenubooleantrueShow export menu
uploadButtonbooleantrueShow upload button
extractionDisplayOptionsExtractionDisplayOptions-Display options for the data viewer

Example

ExtractionReviewer Example
import { ExtractionReviewer } from "@retab/react";
import { useRouter, useSearchParams } from "next/navigation";

function ReviewPage({ projectId }: { projectId: string }) {
  const router = useRouter();
  const searchParams = useSearchParams();
  const extractionId = searchParams.get("extractionId");

  const handleNavigate = ({ extractionId }) => {
    const url = extractionId
      ? `/review?extractionId=${extractionId}`
      : `/review`;
    router.push(url);
  };

  return (
    <ExtractionReviewer
      projectId={projectId}
      extractionId={extractionId}
      onNavigate={handleNavigate}
      visibility={{
        search: true,
        uploadButton: true,
        extractionDisplayOptions: {
          allowEditing: true,
          showTabs: true,
        },
      }}
      initialFilters={[
        {
          id: "status_filter",
          field: "status",
          operator: "is",
          value: "review_required",
        },
      ]}
    />
  );
}

ExtractionComponent

Side-by-side file preview and data display with resizable panels. Supports file upload and real-time streaming extraction.

Props

PropTypeDefaultDescription
extractionIdstring-The extraction ID to display
projectIdstring-The project ID
isNewExtractionbooleanfalseWhether this is a new extraction (shows upload UI)
extractionDisplayOptionsExtractionDisplayOptions-Display options for the data viewer
continueButtonOptionsContinueButtonOptions-Continue button configuration

ContinueButtonOptions

OptionTypeDefaultDescription
onClick() => void-Callback when continue button is clicked
labelstring"Continue"Button label text

Example

ExtractionComponent Example
import { ExtractionComponent } from "@retab/react";

function ExtractionView({ extractionId, projectId }) {
  return (
    <ExtractionComponent
      extractionId={extractionId}
      projectId={projectId}
      extractionDisplayOptions={{
        view: "form",
        allowEditing: true,
        showTabs: true,
      }}
      continueButtonOptions={{
        onClick: () => console.log("Marked as reviewed"),
        label: "Mark as Reviewed",
      }}
    />
  );
}

UploadJobsList

Upload files and track processing jobs. Supports drag-and-drop, batch uploads, and progress tracking.

Props

PropTypeDefaultDescription
metadataRecord<string, string>-Optional metadata to associate with uploads

Example

UploadJobsList Example
import { UploadJobsList } from "@retab/react";

function UploadPage() {
  return (
    <UploadJobsList
      metadata={{
        source: "web-upload",
        user_id: "user_123",
      }}
    />
  );
}

Filter Types

Filters can be used with ExtractionsList and ExtractionReviewer to control which extractions are displayed.

FilterType

FieldTypeDescription
idstringUnique identifier for the filter
field"created_date" | "status" | "metadata"Field to filter on
operator"after" | "before" | "within" | "is" | "is_not" | "contains"Filter operator
valuestring | DateFilter value
endValueDateEnd date for “within” operator
metadataKeystringKey for metadata filters

Example Filters

Filter Examples
const filters = [
  // Status filter
  {
    id: "status_filter",
    field: "status",
    operator: "is",
    value: "review_required",
  },
  // Date filter
  {
    id: "date_filter",
    field: "created_date",
    operator: "after",
    value: new Date("2024-01-01"),
  },
  // Metadata filter
  {
    id: "metadata_filter",
    field: "metadata",
    operator: "is",
    metadataKey: "department",
    value: "finance",
  },
];