Import mapping
A React component in Beamline's Data & tables category.
Map the columns of a file to the fields of one record type, see what every value becomes, then run the import and get an outcome for each row: suggestions are hints until accepted, ambiguous dates are named, and only failed rows are retried.
Use it for
- Importing a spreadsheet or export into one record type (accounts, contacts, products) after the application has read the file.
- Any column-to-field mapping where values are converted and some may fail: dates, people, amounts.
- Large or nested destinations (dozens of fields, grouped paths) that need search and a destination checklist.
Not for
- Choosing or uploading the file itself → file-dropzone (place it before this).
- Reviewing proposed edits to existing rows → diff-table.
- Editing records after import → data-grid.
- Mapping value lists (Hot → Negotiation) or building transforms → the application's own form.
Anatomy
- header: title, source line (file · rows · columns → destination), steps (Map columns / Preview / Import)
- stage heading (focus target) and a polite status region
- map: toolbar (filter with counts, search, bulk Accept suggestions / Don't import undecided, check status)
- map: summary of blockers with links (after a blocked Preview)
- map: pairs in file order — source (grip, name, path, samples), seam, chooser, suggestion with Accept, interpretation, check, invalid-value policy, transfer notice with Undo
- map: destinations panel in destination order (grouped by path), each field mapped / not mapped / required; drop targets
- preview: table of sample rows in destination order (field, from-column lineage, Change), converted cells, invalid cells with reasons; scope line
- import: progress (measured when reported), Cancel; result counts, outcomes list (failed first), lifetime note
- footer: Back · Preview / Import N rows / Retry N failed rows · View records · Done
Variants
- frame: surface, none
- layout: auto, stacked
States
- map: undecided, suggested, mapped, skipped (Don't import), transferred (notice + Undo)
- check: checking (stale revision), ok, invalid (count, examples, policy), ambiguous (interpretation needed), assessment error (Retry; each mapped row keeps its check line, "Not checked", with its last rows dimmed, so the rows never close up)
- blocked: summary of what to settle before preview
- preview: read-only, rows that won't import and why
- import: working (progress, Cancel when supported), request rejected (back to preview, draft kept), result, partial failure (retry failed rows only), retrying, cancelled (remaining rows offered)
- disabled, empty (no columns)
Keyboard
- Tab moves through pairs in file order; each chooser keeps focus after Enter picks a field
- Chooser: ↓/↑ open and move, type to filter by name, path or type (several words match across them: “billing city”), Enter chooses, Esc closes and restores; nested fields sit under their path's heading. Below 640 px the chooser opens as a bottom sheet with its own search and focus returns to the field
- Accept on a suggestion moves focus to that pair's chooser
- Interpretation and invalid-value policy are radio groups: arrows choose
- Undo on a transfer notice restores both pairs and returns focus to the pair being edited
- Destinations panel is one tab stop: ↑/↓, Home/End, type-ahead; Enter on a mapped field focuses its pair, on an unmapped field opens a source picker
- Preview: Change on a column returns to that pair; Back returns to the Preview button with the list scrolled as it was
- Every stage change moves focus to the stage heading
Motion
Choosing never moves anything; notices and the blocker summary open with the disclosure height transition (in 90ms, out 180ms); stage bodies fade in 90ms under an anchored header; drag shows a ghost chip that fades out on cancel. Reduced motion: same content and focus, all transitions instant.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
source (required) | ImportSource | — | Source file schema, columns and sample rows to map. Required. |
destination (required) | ImportDestination | — | Destination schema whose fields the source columns map to. Required. |
value / defaultValue / onValueChange | ImportMappingDraft | — | value: Controlled mapping draft for the source columns; omit to use defaultValue. defaultValue: Initial column mapping draft; defaults to an empty mapping at revision zero. onValueChange: Reports mapping draft for the source columns after an edit; no callback by default. |
suggestions | Record<sourceColumnId, ImportSuggestion> | — | Hints keyed by SOURCE column ID. Never accepted automatically. |
assessment | ImportMappingAssessment | — | Checks for the current draft revision, computed by you (sync or async). |
onAssessmentRetry | () => void | — | Retries the failed assessment request; no handler by default. |
stage / defaultStage / onStageChange | "map" | "preview" | "import" | — | stage: Controlled workflow stage; omit to use defaultStage. defaultStage: Initial workflow stage when uncontrolled; defaults to map. onStageChange: Reports deal stage after a change; no callback by default. |
onImport | (request, { onProgress, signal }) => Promise<ImportResult> | — | Runs the import. Reject only when nothing was written; otherwise resolve with an outcome per processed row. |
cancellable | boolean | — | Offers cancellation while an import runs. Defaults to false. |
result / defaultResult / onResultChange | ImportMappingResultState | null | — | result: Controlled result of the operation; omit to use defaultResult. defaultResult: Initial result when uncontrolled. Defaults to null. onResultChange: Reports result after a change; no callback by default. |
onBack | () => void | — | Back from the Map stage to your previous step (the file). |
onOpenRecords / recordHref | (recordIds) => void / (recordId) => string | — | onOpenRecords: Opens the records represented by a summary; no handler by default. recordHref: Builds a destination-record URL from its id; omitted by default to show no record link. |
resultActions / onDone / lifetimeNote | ReactNode / () => void / ReactNode | — | resultActions: Actions available on each result. Defaults to no result actions. onDone: Runs when the animation or operation finishes; no handler by default. lifetimeNote: Text explaining how long the import summary remains available. Defaults to "This summary stays until you leave this page.". |
frame | "surface" | "none" | — | Frame treatment around the content. Defaults to "surface". |
layout | "auto" | "stacked" | — | Arrangement of the component within its container. Defaults to "auto". |
drag | boolean | — | Lets people map source columns by dragging. Defaults to true. |
title / emptyLabel / disabled / className / classNames | mixed | — | title: Heading shown above the content. Defaults to no heading. emptyLabel: Message shown when no data is available. Defaults to "This file has no columns to map". disabled: Prevents interaction with the control. Defaults to false. className: Classes on the documented visual root; no override by default. classNames: Classes for the named visual parts; no part overrides by default. |
value | ImportMappingDraft | — | Controlled mapping draft for the source columns; omit to use defaultValue. |
defaultValue | ImportMappingDraft | — | Initial column mapping draft; defaults to an empty mapping at revision zero. |
onValueChange | ((draft: ImportMappingDraft) => void) | — | Reports mapping draft for the source columns after an edit; no callback by default. |
stage | ImportMappingStage | — | Controlled workflow stage; omit to use defaultStage. |
defaultStage | ImportMappingStage | — | Initial workflow stage when uncontrolled; defaults to map. |
onStageChange | ((stage: ImportMappingStage) => void) | — | Reports deal stage after a change; no callback by default. |
result | ImportMappingResultState | null | — | Controlled result of the operation; omit to use defaultResult. |
defaultResult | ImportMappingResultState | null | — | Initial result when uncontrolled. Defaults to null. |
onResultChange | ((result: ImportMappingResultState) => void) | — | Reports result after a change; no callback by default. |
onOpenRecords | ((recordIds: string[]) => void) | — | Opens the records represented by a summary; no handler by default. |
recordHref | ((recordId: string) => string) | — | Builds a destination-record URL from its id; omitted by default to show no record link. |
resultActions | ReactNode | — | Actions available on each result. Defaults to no result actions. |
onDone | (() => void) | — | Runs when the animation or operation finishes; no handler by default. |
lifetimeNote | ReactNode | — | Text explaining how long the import summary remains available. Defaults to "This summary stays until you leave this page.". |
title | ReactNode | — | Heading shown above the content. Defaults to no heading. |
emptyLabel | string | — | Message shown when no data is available. Defaults to "This file has no columns to map". |
disabled | boolean | — | Prevents interaction with the control. Defaults to false. |
className | string | — | Classes on the documented visual root; no override by default. |
classNames | Partial<Record<ImportMappingSlot, string>> | — | Classes for the named visual parts; no part overrides by default. |
ref | Ref<HTMLDivElement> | — | Receives the documented root element; no ref by default. |
Built from
- Alert
- Bottom sheet
- Button
- Checkbox
- Chip group
- Combobox
- Dropdown menu
- Glow
- Kbd
- Label
- Pagination
- Popover
- Progress
- Radio group
- Search field
- Select
- Skeleton
- Slot text
- Spinner
- Stepper
- Table
- Tooltip
Dependencies
lucide-react
Import
import { ImportMapping } from "@beamline/import-mapping";
Get it
Import mapping is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent
More in Data & tables
- Living table: A table that shows as much as fits on both axes: width decides which columns show (the rest ride in the name line, moving there rather than vanishing)…
- Availability layers: A week of bookable start times whose closed times explain themselves: every availability rule (hours, time off, bookings, buffers, rooms, lead time…
- Capacity terrain: A schedule that stands on a terrain of capacity: under each station's lane of jobs, every day's load rises to its capacity line and an overload is a…
- Domino move: A room board where one move shows its chain: drag a booking (or pick it and aim it with the keys) onto a taken room and the bookings it would push appear…
- Match board: Month-end matching as one picture: bank lines and books entries side by side with threads between them — solid for matched, dashed with the host's reason…
- Split anything: One splitter for money, quantities and time: a bar of the whole shows every target's part and what is not split yet; items are dragged onto targets…
- Approval route: A policy you can read by trying it: an amount on a log scale with the thresholds as marks (the arrows stop just under, at and just over each), the…
- Proposal twin: A proposal edited beside the client's exact page, the two linked both ways: a field in focus lights its twin on the page, scrolls it into view and joins…
- Quantity river: The life of one order line's quantity: at rest a bar of its real split ("5 delivered · 1 back in stock · 1 damaged · 5 cancelled"), unfolding into a…
- Stock horizon: Projected stock per item over the coming weeks: a strip of weeks with the safety line, weeks under safety in warn and short in danger, every dip said in…
- Ageing queue: Tickets that visibly age: each ticket's ring fills toward its own service target and steps from on time to late to very late, the words say when it is…
- Import lens: A messy import made fixable by kind: rows stream through the checks once with live counts; problems gather into groups that say what is wrong in words…
- Duplicate guard: A new record that watches for the one that already exists: as you type, the likely duplicates slide in beside the form with the fields that match lit and…
- Scan flow: A pick list that takes scans: each scan flies from the scan field into its row and fills that row's quantity ring, and the prompt moves to the next bin…
- Pack planner: The packing bench: the order's items sit in box outlines drawn to scale, each box filling to its padding line, weighing against its limit and naming the…
- Provenance lens: Hold Alt (or press Lens) over any number on the page and see what makes it: hairline threads draw from the number to the rows, cards and documents on…
- Record time machine: The record itself, rewound in place: a slim track of every change (a tick per change in its person's colour, hollow for automation, named moments as…
- Tension timeline: A plan where slack is something you see: every dependency is a string from one task's end to the next one's start, sagging with the days it has to spare…
- Replay bar: Rewind for anything live: pause a stream, scrub back to the moment you missed (markers for the ones that matter), step one update at a time, replay at a…
- Event calendar: A schedule of events by day, week or month: events that overlap sit side by side, drag one to another time or day or pull its bottom edge to change its…
- Kanban board: Work as cards in columns by stage: drag a card (or lift it with Space and walk it with the arrows) to another column or place, the cards around it make…
- Data grid: Virtualised local or server-driven grid: stable row IDs, manual sort and filters, pages or infinite loading, retry without losing rows, inline editing…
- Pivot table: Records summed up by the fields people choose: rows grouped by one or more fields that fold open level by level, columns split by another, one or more…
- Query builder: Conditions people build by hand to pick out records: each rule is a field, an operator that fits the field (contains, between, in the last N days, is any…
- Sort order: Several sort keys in order. Each key says its rank in words ("Sort by Plan, A to Z", "then by Size, largest first") with its order named for the field's…
- Metric rules: Ordered rules that colour a dashboard number. Each rule has a name for what its colour means ("At risk", not just red) and a tone (good, watch, act…
- Log viewer: Log lines as they stream: it follows the newest line until you scroll up, then counts what arrived and brings you back in one click; filter by level with…
- JSON viewer: A JSON value as a tree you can read and walk: branches open and close (one level, or all at once), closed ones preview what they hold, every value reads…
- JSON diff viewer: Two versions of a JSON value compared as one tree: added keys marked +, removed ones struck through with −, changed values read old → new, unchanged keys…
- Diff table: Proposed edits to a table before they happen: new rows green, removals struck through, changed cells old → new; each change can be left out and Apply…
- Filter toolbar: The filters on a list kept in view: chips that remove themselves, Add filter with fields and their values, Clear all, and room for search or view controls.
- Table: A native HTML table for small datasets, composed with children or driven by records; shared server paging, sorting, filters, search, stable-ID selection…