This section details each property available for the Importer component.
Type: SheetDefinition[]
Required: Yes
Description:
Array of sheet definitions for importing data. This property defines the structure of the data to be imported.
Type: (data: ImporterState, onProgress: (progress: number) => void) => Promise<ImportStatistics | void>
Required: Yes
Description:
A callback function invoked when the import process completes. It receives the final data and a progress callback.
An ImportStatistics
object can be returned to provide detailed information about the import results. The statistics object has the following properties:
imported
: Number of rows successfully importedfailed
: Number of rows that failed to importskipped
: Number of rows that were skippedThese statistics will be displayed in the import summary and can be used to show detailed import results to the user.
Type: 'default' | 'theme-1' | 'theme-2'
Required: No (Default: default
)
Description:
Determines the visual theme of the importer component.
Type: (data: SheetState) => Promise<SheetState> | SheetState
Required: No
Description:
Callback executed after CSV columns are mapped to the sheet definitions. Allows for custom post-mapping processing.
Type: boolean
Required: No (Default: false
)
Description:
Indicates whether manual data entry is allowed during the preview phase.
Type: 'en' | 'fr' | 'pt-BR'
Required: No (Default: en
)
Description:
Specifies the locale for internationalization purposes.
Type: boolean | (errors: ImporterValidationError[]) => boolean
Required: No (Default: false
)
Description:
Controls whether file upload should be prevented when validation errors occur. Can be a boolean or a function that returns a boolean.
Type: number
Required: No (Default: 20971520
i.e., 20MB)
Description:
Sets the maximum allowed file size in bytes. Files exceeding this limit will be rejected.
Type: (sheetDefinitions: SheetDefinition[], csvHeaders: string[]) => ColumnMapping[] | Promise<ColumnMapping[]>
Required: No
Description:
Provides a custom function to generate suggested mappings based on CSV headers.
Type: () => void
Required: No
Description:
Callback executed when the user has finished reviewing the import summary. This can be used to navigate users to a results page, dashboard, or next step in the workflow after the import process completes successfully.
Type: { enabled: boolean; customKey?: string }
Required: No
Description:
Configuration for IndexedDB storage. When enabled, the importer state will be persisted in the browser’s IndexedDB storage, allowing users to resume their import process if the page is refreshed or closed. The customKey
option allows specifying a unique identifier for the stored data.
Use cases for customKey
:
Multiple Import Sessions: When you need to handle multiple import processes simultaneously in the same application, you can use different customKey
values to keep their states separate.
User-Specific Storage: When implementing a multi-user system, you can use the user’s ID as the customKey
to maintain separate import states for each user.
Session Management: You can use the customKey
to implement session-specific storage, allowing you to clear specific import sessions without affecting others.
This section details each property available for the Importer component.
Type: SheetDefinition[]
Required: Yes
Description:
Array of sheet definitions for importing data. This property defines the structure of the data to be imported.
Type: (data: ImporterState, onProgress: (progress: number) => void) => Promise<ImportStatistics | void>
Required: Yes
Description:
A callback function invoked when the import process completes. It receives the final data and a progress callback.
An ImportStatistics
object can be returned to provide detailed information about the import results. The statistics object has the following properties:
imported
: Number of rows successfully importedfailed
: Number of rows that failed to importskipped
: Number of rows that were skippedThese statistics will be displayed in the import summary and can be used to show detailed import results to the user.
Type: 'default' | 'theme-1' | 'theme-2'
Required: No (Default: default
)
Description:
Determines the visual theme of the importer component.
Type: (data: SheetState) => Promise<SheetState> | SheetState
Required: No
Description:
Callback executed after CSV columns are mapped to the sheet definitions. Allows for custom post-mapping processing.
Type: boolean
Required: No (Default: false
)
Description:
Indicates whether manual data entry is allowed during the preview phase.
Type: 'en' | 'fr' | 'pt-BR'
Required: No (Default: en
)
Description:
Specifies the locale for internationalization purposes.
Type: boolean | (errors: ImporterValidationError[]) => boolean
Required: No (Default: false
)
Description:
Controls whether file upload should be prevented when validation errors occur. Can be a boolean or a function that returns a boolean.
Type: number
Required: No (Default: 20971520
i.e., 20MB)
Description:
Sets the maximum allowed file size in bytes. Files exceeding this limit will be rejected.
Type: (sheetDefinitions: SheetDefinition[], csvHeaders: string[]) => ColumnMapping[] | Promise<ColumnMapping[]>
Required: No
Description:
Provides a custom function to generate suggested mappings based on CSV headers.
Type: () => void
Required: No
Description:
Callback executed when the user has finished reviewing the import summary. This can be used to navigate users to a results page, dashboard, or next step in the workflow after the import process completes successfully.
Type: { enabled: boolean; customKey?: string }
Required: No
Description:
Configuration for IndexedDB storage. When enabled, the importer state will be persisted in the browser’s IndexedDB storage, allowing users to resume their import process if the page is refreshed or closed. The customKey
option allows specifying a unique identifier for the stored data.
Use cases for customKey
:
Multiple Import Sessions: When you need to handle multiple import processes simultaneously in the same application, you can use different customKey
values to keep their states separate.
User-Specific Storage: When implementing a multi-user system, you can use the user’s ID as the customKey
to maintain separate import states for each user.
Session Management: You can use the customKey
to implement session-specific storage, allowing you to clear specific import sessions without affecting others.