Create a new Space every time Flatfile is opened.
For synchronous data import/exchange completed in one session, create a new Space each time Flatfile is opened. This suits situations where a clean slate for every interaction is preferred.
To complete this tutorial, you'll need to retrieve your Publishable
key from your development
environment.
Note: The Publishable Key is safe to be used in client-side applications as it has limited access to the Flatfile API.
Make a new directory.
Go into that directory.
Follow prompts from the init
command.
Install packages.
Setup your app to look something like this:
In this file structure, your app should have two main directories, public
and src.
The public
directory contains the index.html
file, which is the entry point of the application’s front-end, and the “style.css” file for styling the iframe.
The src
directory contains the main components and logic of the application, including the App.tsx
file, which initializes Flatfile and passes in available options.
Add a button to your application to open Flatfile in a modal. Pass in your publishableKey
and a new Space will be created on each page load. Also, add the content here to your styles.css
.
In your App.tsx
, at minimum, you’ll need to pass in the publishableKey
. Also, add the content here to your index.tsx
, tsconfig.json
, manifest.json
, and config-overries.js
.
You’ll get an alert: We’re unable to detect target browsers. Would you like to add the defaults to your package.json? Say yes.
Now, let's build a Workbook inside the Space for next time.
src/workbook.ts
file with this simple Blueprint.App.tsx
to import the Workbook.Next time you open Flatfile, you'll see a Workbook called "Contacts" that has one Sheet with three fields. Your Workbook will also have a Submit action. We will configure this action in the next step.
Next, we'll listen for data changes and respond using an event listener.
src/listener.ts
file with this simple recordHook
.App.tsx
to import the listener.Once you add this code, when a change occurs, we'll log the entered first name and update the last name to "Rock." You'll immediately see this begin to work when you add or update any records.
By attaching a themeConfig
to flatfileOptions
in src/App.tsx
, we will now override colors in your Space to match your brand. See all of the options here in the Theming Reference.
Finally, let's get the data out of our system and to your destination.
listener.ts
with this simple submit action.Once you add this code, when the submit button is clicked, this will be the place you can egress your data. Learn more about Egress Out
You can stop here or you can view our full reference to see all the ways you can customize your importer.
Find this React example project in the Flatfile GitHub repository.
Create a new Space every time Flatfile is opened.
For synchronous data import/exchange completed in one session, create a new Space each time Flatfile is opened. This suits situations where a clean slate for every interaction is preferred.
To complete this tutorial, you'll need to retrieve your Publishable
key from your development
environment.
Note: The Publishable Key is safe to be used in client-side applications as it has limited access to the Flatfile API.
Make a new directory.
Go into that directory.
Follow prompts from the init
command.
Install packages.
Setup your app to look something like this:
In this file structure, your app should have two main directories, public
and src.
The public
directory contains the index.html
file, which is the entry point of the application’s front-end, and the “style.css” file for styling the iframe.
The src
directory contains the main components and logic of the application, including the App.tsx
file, which initializes Flatfile and passes in available options.
Add a button to your application to open Flatfile in a modal. Pass in your publishableKey
and a new Space will be created on each page load. Also, add the content here to your styles.css
.
In your App.tsx
, at minimum, you’ll need to pass in the publishableKey
. Also, add the content here to your index.tsx
, tsconfig.json
, manifest.json
, and config-overries.js
.
You’ll get an alert: We’re unable to detect target browsers. Would you like to add the defaults to your package.json? Say yes.
Now, let's build a Workbook inside the Space for next time.
src/workbook.ts
file with this simple Blueprint.App.tsx
to import the Workbook.Next time you open Flatfile, you'll see a Workbook called "Contacts" that has one Sheet with three fields. Your Workbook will also have a Submit action. We will configure this action in the next step.
Next, we'll listen for data changes and respond using an event listener.
src/listener.ts
file with this simple recordHook
.App.tsx
to import the listener.Once you add this code, when a change occurs, we'll log the entered first name and update the last name to "Rock." You'll immediately see this begin to work when you add or update any records.
By attaching a themeConfig
to flatfileOptions
in src/App.tsx
, we will now override colors in your Space to match your brand. See all of the options here in the Theming Reference.
Finally, let's get the data out of our system and to your destination.
listener.ts
with this simple submit action.Once you add this code, when the submit button is clicked, this will be the place you can egress your data. Learn more about Egress Out
You can stop here or you can view our full reference to see all the ways you can customize your importer.
Find this React example project in the Flatfile GitHub repository.