Skip to content

Loading Data

Type(onChunk: (rows: TRow[], options?: ChunkSourceOptions) => void) => Promise<void>

Async function that feeds data into the editor. Called once when the editor opens. Call onChunk one or more times to stream rows in batches. The editor processes each chunk without blocking the UI.

loadData={async (onChunk) => {
const res = await fetch("/api/employees");
const rows = await res.json();
onChunk(rows);
}}

Tag chunks with a data source to separate data from different origins. Sources are auto-registered on first encounter.

loadData={async (onChunk) => {
const [sf, hs] = await Promise.all([fetchSalesforce(), fetchHubspot()]);
onChunk(sf.chunk1, { source: "Salesforce" });
onChunk(sf.chunk2, { source: "Salesforce", done: true });
onChunk(hs.data, { source: "HubSpot", deletable: true, done: true });
}}

Chunks without options go to “Existing Data”. You can mix tagged and untagged chunks freely.

FieldTypeDefaultDescription
sourcestringDisplay name for the data source. Required when tagging a source.
idstringsource valueStable identifier.
deletablebooleanfalseWhether the user can delete this source from the editor.
donebooleanfalseMarks this source as finished loading. Shows a completion state in the UI.
  • The first onChunk call with a new source auto-registers it and starts its loading indicator.
  • Set done: true to mark a source as finished. You can send an empty chunk: onChunk([], { source: "CRM", done: true }).
  • When the loadData promise resolves, any source still loading is automatically finalized.
TypeRecord<string, unknown>[]

Sample rows included in the “Download Example” file. When the user clicks “Download Example” in the import wizard, the SDK generates a template file with column headers and these rows.

When omitted, a generic example row is auto-generated from column definitions.

sampleData={[
{ name: "Jane Smith", email: "[email protected]", role: "Admin" },
{ name: "John Doe", email: "[email protected]", role: "Editor" },
]}