React component reference

Package: @bootstrapware/importer
Styles: @bootstrapware/importer/styles.css

Props

PropTypeRequiredNotes
onComplete(rows, meta) => void | Promise<void>yesValid rows only, plus ImportMeta. Throw or reject to show an error and retry.
fieldsImporterField[]for local modeSchema in code. Supports valueMap, transform, and validate on fields.
importerIdstringhostedWith publishableKey
publishableKeystringhostedBrowser-safe
apiBaseUrlstringnoDefaults to https://importer.bootstrapware.co
duplicateKeystringnoField key for in-file duplicates
dateOrder"MDY" | "DMY"noSlash/dash/dot numeric dates. Default MDY. Day or month above 12 is unambiguous. ISO stays YYYY-MM-DD.
numberLocale"us" | "eu" | "auto"noDefault auto. Semicolon CSVs prefer EU (bare 1.234 → 1234).
dir"ltr" | "rtl"noWidget text direction. Default ltr. Use with strings for RTL chrome copy.
stringsPartial<ImporterStrings>noOverride chrome copy. Missing keys stay English. Type-error messages are not in this map. Not an ARIA grid; no WCAG AA claim.
titlestringnoDefault "Import spreadsheet"
theme"light" | "dark"noOmit for the light cream default. No data-theme and no system theme.
presentation"section" | "modal" | "window" | "launcher"noDefault section (inline). Modal, window, and launcher start closed unless defaultOpen. A successful import closes those overlays. Escape closes them. The backdrop closes modal and launcher.
useWorkerbooleannoOpt-in Web Worker parse with main-thread fallback. Not a million-row editor.
primaryKeystringnoWith existingKeys, fills meta.upsert.
existingKeys(string | number)[]noHost-owned prior keys. Never sent to Bootstrapware.
defaultOpenbooleannoOpen modal, window, or launcher on first render. Ignored for section.
onCancel() => voidnoCancel on preview

Hosted mode is used when both importerId and publishableKey are set. Local fields can be omitted until hosted config loads.

Theme

theme is "light" | "dark". Omit it and the shell stays the light cream default: the root has no data-theme attribute. theme="light" sets data-theme="light" and keeps those light tokens. theme="dark" sets data-theme="dark" and applies the dark shell. v1 does not follow prefers-color-scheme or the system theme.

Hosts may set these CSS custom properties on the embed root (.bsw-importer). These overrides are the supported API. Do not fight .bsw-* classes. When theme="dark" is set, target .bsw-importer[data-theme="dark"] so your values win over the dark defaults.

  • --bsw-bg
  • --bsw-panel
  • --bsw-fg
  • --bsw-muted
  • --bsw-line
  • --bsw-accent
  • --bsw-accent-fg
  • --bsw-radius
.bsw-importer[data-theme="dark"] {
  --bsw-bg: #161714;
  --bsw-panel: #22241c;
  --bsw-fg: #f4f4ee;
  --bsw-muted: #b3b4aa;
  --bsw-line: #4a4c42;
  --bsw-accent: #c8ef00;
  --bsw-accent-fg: #161714;
  --bsw-radius: 12px;
}

Hosted primaryColor, when set, writes --bsw-accent inline on the root and overrides the theme accent.

Flow

Upload → map columns (pick a sheet when the workbook has more than one, and pick the header row when title rows sit above the real headers) → preview (first 100 rows shown; uncheck Include to leave a valid row out) → import the included valid rows, download errors, or download valid rows. Preview stays blocked until every required field is mapped. Assigning a header to one field clears it from other fields. Column dropdowns show sample cell values from the file.

On the upload step, once local fields or hosted published config is known, Download template.csv generates a file in the browser. Headers use field labels, falling back to keys when a label is empty. One example row is derived from field type. The template is not fetched from Bootstrapware. Paste from clipboard and Ctrl/Cmd+V parse text/plain (including tab-separated Excel/Sheets copies) in the browser.

Related: Fields · Column mapping · Validation · onComplete · Quickstart