React
Installation
Use NPM or Yarn to install the SDK package.
NPM
Yarn
Example
Properties
The unique ID for the importer. The SDK used this ID to pull in the template schema that you set up in the Admin Dashboard, or you can override this by adding the template parameter. Obtain from your importer in the TableFlow admin app.
When set to true
(default value), the importer will behave as a modal with its open state controlled by
modalIsOpen
. When set to false
, the importer will be embedded directly in your page.
Only used when isModal
is true
: Controls the importer modal being open or closed.
Only used when isModal
is true
: A function called when the user clicks the close button or clicks outside of (when
used with modalCloseOnOutsideClick
) the importer. useState
can be used to control the importer modal opening and
closing.
It also includes an optional parameter, importComplete
, to show if the import was completed before being closed.
importComplete
will be true
if the user successfully submits an import and will become false
again if they
choose “Upload another file” after submission.
Only used when isModal
is true
: Clicking outside of the modal will call the modalOnCloseTriggered
function.
Configure the columns used for the import. If provided, this template will override what is defined in your importer in the TableFlow admin app. This can be useful if columns you want your users importing change depending on a condition in your application.
See the full schema and available options for Templates.
Allows users to import a file without mapping their columns to a template. With this option enabled, the Review screen
lets users input custom destination column keys, or use pre-generated keys based on the column names. Note this option
will override both the template in the TableFlow admin app and the template
prop, if provided.
Toggle between dark mode (true
) and light mode (false
).
Specifies the primary color for the importer in hex format. Use customStyles
to customize the UI in more detail.
Provides a CSS class for the container.
Apply custom styles to the importer with an object containing CSS properties and values. Note that custom style
properties will override primaryColor
and any default styles from darkMode
.
Available options:
Completely customize every aspect of the importer by passing in CSS overrides.
Pass metadata as a JSON object or string. This metadata will be available when retrieving imported data via the API. An example use case is associating a user ID in your application to an import so when the data is retrieved, you’ll know which user the data belongs to.
Callback function that fires when a user completes an import. It returns data
, an object that contains the row data,
column definitions, and other information about the import.
error
will be set and
the data should be retrieved using the API.Example data
:
When set to true
, the importer will not display the final completion screen after the import is submitted. Instead,
it will stay in a loading state until it is closed programmatically.
When set to false
, hide the Download Template button on the first screen of the importer.
When set to true
, the importer will not display and skip the Header Row Selection step and always choose the first
row in the file as the header.
The URL of where the importer iframe is hosted. This should only be set when self-hosting TableFlow.
When set to true
, all leading and trailing spaces in cells will be removed during the initial file upload.
When set to false
, hide the “Upload another file” button on the Review screen of the importer.