Import Wizard
ProA 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.
import { SvImportWizardComponent } from '@styloviz-pro/forms/import-wizard';Demo & usage
Basic usage
Usage example — open the gallery for the full interactive demo.
An interactive demo for this component lives in the gallery.
Open live demoMore examples
Fields, and a save that reports progress
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
`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
The same checks on a server
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
| Name | Type | Default | Description |
|---|---|---|---|
| fields | readonly SvImportField[] | [] | The fields to fill: `{ key, label, required?, type?, options?, aliases?, validate? }`. Rows with an empty or repeated `key` are ignored. |
| maxSizeMb | number | 10 | Largest file accepted, in MB. |
| previewRows | number | 50 | Rows shown in the review grid (and entries in the error summary), 1–500. |
| headerRow | boolean | 'auto' | 'auto' | Whether the file's first row holds column names; `'auto'` detects it. The user can switch it on the mapping step. |
| delimiter | SvCsvDelimiter | 'auto' | 'auto' | The field separator, or `'auto'` to detect `,` `;` or tab. |
| allowPaste | boolean | true | Offer a text area to paste CSV as well as the file picker. |
| commitAction | SvImportCommitAction | null | null | Save 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. |
| headingLevel | 2 | 3 | 4 | 2 | Level of each step's heading, so the wizard sits correctly in the page outline. |
| labels | Partial<SvImportWizardLabels> | {} | Per-instance text, merged over the registry's `formsPro` labels. |
Outputs
| Event | Payload type | Description |
|---|---|---|
| importRequest | SvImportRequest | The user pressed Import and no `commitAction` is bound: save `records`, then call `resolve()` — or `reject(error)` to show the failure and offer Try again. |
| imported | SvImportSummary | The save resolved: `{ fileName, imported, skipped, rejected }`. |
| stepChange | SvImportStep | The 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.