ComponentsFlows & wizards

Export

Export a collection: scope (selected / current view / all), columns (searchable, reorderable, personal data maskable), format (CSV, XLSX, JSON) with locale CSV conventions, a reason for personal-data exports, and background jobs with a focusable download link. exportToBlob writes the file; XLSX loads write-excel-file only when chosen.

Dialog / Sheet · Radio Group · Checkbox · Sortable business/export.tsx, business/export-core.ts, data-table/csv.tstheme · material · accent · density · font

Installation

$ pnpm add @vamos-ui/react

The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";

Usage

import { ExportDialog, exportToBlob } from "@vamos-ui/react/business";

<ExportDialog
  resource="contacts"
  columns={columns}
  listState={listState}
  selectedCount={selection.length}
  filteredCount={total}
  totalCount={allContacts}
  trigger={<Button><Download /> Export</Button>}
  onExport={async (r) => r.scope === "all" ? api.exports.start(r) /* → { jobId } */ : { blob: await exportToBlob({ rows, columns: pick(r.columns), format: r.format, masked: r.masked }) }}
  pollJob={api.exports.status}
/>

Scope and format are radio groups, columns a checkbox list with select-all and drag or keyboard reordering. File names carry the local date: contacts-2026-11-10.csv. Writing the audit entry is the app's job — onExport receives the reason.

Examples

Excel with typed cells

XLSX first: numbers and dates stay typed, the header row is bold. JSON for developers.

Large export as a job

Above syncLimit the dialog says it runs in the background; onExport returns { jobId } and pollJob drives the progress bar until a download link appears (and takes focus).

Personal data (KVKK / GDPR)

Sensitive columns are flagged and masked by default. Unmasking shows a notice and requires a reason, passed to onExport for your audit log. Shown as a Sheet.

Locale CSV conventions

tr-TR writes ; with decimal commas and a BOM so Turkish Excel splits columns; en-US writes , and points. QuickExportButton exports the current view in one click.

en-US
3 rows
tr-TR
3 rows

API

ExportDialog

PropTypeDefault
columns
{ id, label, personalData?, maskByDefault?, defaultSelected?, accessor?, type? }.
ExportColumn[]—
onExport
r = { scope, columns (ordered), masked, format, reason?, csv, filename }. A blob downloads at once; a jobId starts polling.
(r: ExportRequest) => Promise<{ blob; filename? } | { jobId }>—
pollJob
Polled every 1.5 s until done or failed (retry).
(jobId) => Promise<{ status; progress?; url?; error? }>—
listState
Describes the current view ("2 filters · search “northpoint”").
ListState—
selectedCount / filteredCount / totalCount
Row counts per scope; selected is disabled at 0.
number—
resource
Plural noun for the title and file name.
string"records"
formats
Offered formats, first is the default.
("csv" | "xlsx" | "json")[]["csv", "xlsx"]
csv
CSV conventions.
{ delimiter?: "," | ";" | "\t"; bom?: boolean; decimal?: "locale" | "." }from the locale
requireReason
Ask for a reason always, or only when unmasked personal columns are included.
boolean | "personal-data""personal-data"
syncLimit
Rows above this are announced as a background export.
number10000
presentation
Container.
"dialog" | "sheet""dialog"
trigger / open / defaultOpen / onOpenChange
Opening, controlled or not.
ReactElement / boolean / fn—
defaultScope / defaultFormat
Initial choices.
ExportScope / ExportFormat—
labels
Built-in strings (export namespace).
Partial<ExportLabels>—

exportToBlob(options)

PropTypeDefault
rows / columns / format
Data in, a file Blob out.
object[] / ExportColumn[] / ExportFormat—
masked
Column ids written masked (a••••@domain.com).
string[]—
locale / csv / sheetName
CSV conventions and the XLSX sheet name.
string / CsvExportOptions / string—

QuickExportButton

PropTypeDefault
onExport
One click: current view, default columns.
() => Promise<{ blob; filename }>—

ExportJobStatus

PropTypeDefault
job / filename / onRetry
The job panel on its own (an exports page).
ExportJobState / string / fn—