Officina UI
Components

ExportToolbar

A dropdown that exports a dataset to CSV, XLSX, JSON, or PDF using your column definitions.

ExportToolbar is a download button whose menu offers the export formats you enable — any of csv, xlsx, json, and pdf. Give it the data rows, a base filename, and columns describing which fields and headers to include; picking a format serializes the data and triggers a file download. The trigger disables itself when there is no data or no columns. It pairs naturally with DataTable.

Example

Preview
import { ExportToolbar } from '@officina/ui';

<ExportToolbar
  data={customers}
  filename="customers"
  formats={['csv', 'json']}
  columns={[
    { key: 'name', header: 'Name' },
    { key: 'plan', header: 'Plan' },
  ]}
/>;

API

PropTypeDefaultDescription
columns*ExportColumn<T>[]—Column definitions controlling which fields and headers are exported.
data*T[]—Rows to export.
filename*string—Base filename (without extension) for the downloaded file.
formats*ExportFormat[]—Export formats to offer (e.g. CSV, JSON).

On this page