@retab/react package exports several React hooks for accessing Retab context and data. These hooks must be used within a RetabProvider.
useProject
Access the current project’s data and configuration.Returns
Example
useProject Example
useExtractions
Access the extractions list and selection state. This hook requires theExtractionsProvider to be enabled (default).
Returns
Example
useExtractions Example
useOptionalExtractions
Same asuseExtractions, but returns null if the extractions context is not available. Useful for components that may be used outside the extractions provider.
Example
useOptionalExtractions Example
useExtraction
Fetch a single extraction by ID. Returns the extraction data and loading state.Parameters
Returns
Example
useExtraction Example
useExtractionList
Query extractions with filters, pagination, and sorting. Returns a React Query result.Parameters
ExtractionListOptions
Returns
Example
useExtractionList Example
useJsonSchema
Access the current project’s JSON schema, including computed fields.Returns
Example
useJsonSchema Example
useAuth
Access the authentication context for making authenticated API requests.Returns
Example
useAuth Example
useOCR
Access OCR context for field location detection and source highlighting.Returns
Example
useOCR Example
Type Definitions
Extraction
Extraction
PaginationMetadata
PaginationMetadata