Import Wizard

Pro

A CSV import in four steps — upload or paste, match columns to your fields, review every row, import the valid ones. The file is read and checked in slices, so 10,000 rows never freeze the page; each bad cell is marked with an icon and its message, an error summary jumps to it, and the rows that failed download as a CSV. The save is yours, through a promise or a resolve / reject request.

</>sv-import-wizard importcsvuploadbulkcolumn mappingvalidationwizarddata importspreadsheet
import { SvImportWizardComponent } from '@styloviz-pro/forms/import-wizard';

Demo & usage

Basic usage

Pro

Usage example — open the gallery for the full interactive demo.

Pro

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Fields, and a save that reports progress

Pro

Each field is a column in YOUR data: a key, a label, a type that checks and converts the cell, and `aliases` for the header names your customers use. `commitAction` receives only the valid rows, already typed.

Your own rule, with the rest of the row

Pro

`validate` runs after the type check passes, with the other converted values beside it. Return a message to reject the cell, `null` to accept it.

Without commitAction: resolve or reject the request

Pro

The same checks on a server

Pro

The pipeline is exported, so a script or a server can reach the verdict the user saw.

When to use

  • Letting customers bring contacts, products, users or transactions from a spreadsheet into your app.
  • Bulk onboarding where you need typed rows and a list of what failed, row by row, before anything is saved.
  • Any CSV whose columns may be named differently from your fields — the mapping step is where that is settled.

Compare with

  • File Upload — File Upload sends files to your server as they are. Import Wizard reads a CSV in the browser, maps and checks every row against your fields, and hands you typed records — the upload step is a File Upload.
  • Smart Paste — Smart Paste fills ONE form from a scrap of free text. Import Wizard brings in many records from a CSV, with every row checked.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
fieldsreadonly SvImportField[][]The fields to fill: `{ key, label, required?, type?, options?, aliases?, validate? }`. Rows with an empty or repeated `key` are ignored.
maxSizeMbnumber10Largest file accepted, in MB.
previewRowsnumber50Rows shown in the review grid (and entries in the error summary), 1–500.
headerRowboolean | 'auto''auto'Whether the file's first row holds column names; `'auto'` detects it. The user can switch it on the mapping step.
delimiterSvCsvDelimiter | 'auto''auto'The field separator, or `'auto'` to detect `,` `;` or tab.
allowPastebooleantrueOffer a text area to paste CSV as well as the file picker.
commitActionSvImportCommitAction | nullnullSave the rows: called with an SvImportRequest; return a promise (or call `request.resolve()` / `reject()`). The wizard tracks it — one save at a time, cancel aborts `request.signal`, a rejection offers Try again. Without it the wizard emits `importRequest` instead.
headingLevel2 | 3 | 42Level of each step's heading, so the wizard sits correctly in the page outline.
labelsPartial<SvImportWizardLabels>{}Per-instance text, merged over the registry's `formsPro` labels.

Outputs

EventPayload typeDescription
importRequestSvImportRequestThe user pressed Import and no `commitAction` is bound: save `records`, then call `resolve()` — or `reject(error)` to show the failure and offer Try again.
importedSvImportSummaryThe save resolved: `{ fileName, imported, skipped, rejected }`.
stepChangeSvImportStepThe wizard moved to another step.

Customization & theming

  • `fields` with `type` `string` / `number` / `date` (ISO) / `email` / `enum` (case-insensitive by value or label), `required`, `aliases` and `validate`.
  • `maxSizeMb`, `previewRows` (grid rows and summary entries, up to 500), `headerRow` (`auto`, or force it), `delimiter` (`auto`, `,` `;` or tab), `allowPaste`, `headingLevel`.
  • Every visible string is a label in the `formsPro` namespace, in 12 language packs; override per instance with `[labels]`.
  • Outputs: `importRequest` (when no `commitAction`), `imported` with `{ fileName, imported, skipped, rejected }`, `stepChange`. Method `reset()` starts over; `errorRowsCsv()` returns the error file as text.

Forms integration

  • sv-import-wizard — Output-driven, not a ControlValueAccessor. A whole import flow with its own steps and save, not a field in your form: bind `[commitAction]` (or handle `(importRequest)`) to store the typed rows, and listen to `(imported)` for the summary.

Best practices

  • Do: Give each field `aliases` for the header names real exports use ("E-mail", "Mail") so most columns match without a click.
  • Do: Save in batches and call `progress(n)`; pass `signal` to your transport so Cancel stops the requests.
  • Don't: Do not trust the browser alone: run `svValidateImport` with the same fields on the server before you store anything.
  • Tip: Return `{ imported }` from `commitAction` when the server stores fewer rows than it was sent; the summary then says what really happened.

Accessibility

  • The four steps are the kit stepper; each step change moves focus to the step heading, so a screen reader hears where it landed.
  • Column mapping uses the kit’s select combobox (APG select-only combobox, listbox portalled). Pressing Next with a required field unmapped names the field in an alert and focuses its combobox, which reports `aria-invalid`.
  • The preview is a `role="grid"` table with one tab stop: arrows move between cells, Home/End to the row ends, Ctrl+Home/End to the corners, PageUp/PageDown by ten rows. `aria-rowcount` / `aria-rowindex` give the position in the full list.
  • A bad cell carries `aria-invalid` and shows an icon and its message as text — never colour alone. The error summary is the kit’s `sv-form-error-summary`; each entry moves focus into the grid cell.
  • Reading, checking and saving progress are `role="progressbar"` with values; failures are `role="alert"`. Buttons and checkboxes are at least 24px targets.
  • Engine: the ADR-aria row asks for `@angular/aria` combobox and grid. The package is not a dependency of the kit yet (it is adopted from 2.1, ADR rule 1), so this ships on the kit’s own select combobox and an APG grid built on `svCollectionTarget`; moving to Aria later changes no input or output.

Feedback on Import Wizard

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.