X Enterprises
Table

TableExport

Dropdown button that exports the current table data to CSV or JSON files.

TableExport

A dropdown trigger button with two built-in export options: CSV (default) and JSON. Selecting an option generates the file from the provided data and columns, triggers a browser download, and emits an export event with the generated content. CSV values are quoted and escape any embedded quotes; nested object paths are supported via dotted column.key values.

Components

<XATableExport />

<XATableExport
  :data="rows"
  :columns="[
    { key: 'name',  label: 'Name'  },
    { key: 'email', label: 'Email' },
    { key: 'user.company', label: 'Company' },
  ]"
  filename="users-export"
  :show-label="true"
  :enable-csv="true"
  :enable-json="false"
  @export="(format, content) => logExport(format, content)"
/>

Props

PropTypeDefaultDescription
dataObject[]requiredArray of row objects to export.
columnsColumn[]requiredColumn descriptors. Each: { key, label, formatter? }. key may be a dotted path like "user.company".
filenamestring'export'Base filename (no extension). The chosen format is appended: users-export.csv.
showLabelbooleantrueWhen true, the trigger button shows the text label "Export" with a chevron. Set to false for icon-only.
enableCsvbooleantrueShow the "Export as CSV" menu item.
enableJsonbooleanfalseShow the "Export as JSON" menu item.

Column shape

interface ExportColumn {
  key: string                          // Required — dotted path into row
  label: string                        // Required — header text
  formatter?: (value: unknown) => unknown  // Optional cell formatter
}

Emits

EventPayloadDescription
export(format: 'csv' | 'json', content: string)Fired after the file is generated and the browser download triggered. content is the raw CSV / JSON string.

AI Context

component: XATableExport
package: "@xenterprises/nuxt-x-app"
category: Table
use-when: >
  Tables where users need to download the visible data for offline analysis
  or sharing. Renders a dropdown trigger button; mounts automatically inside
  XATableToolbar when the toolbar's `exportable` and `data` props allow.
nested-keys: "Use dotted column.key like 'user.company' to traverse row objects."
Copyright © 2026