Bulk Action
BulkActionExport
Export selected rows to CSV or JSON.
Bulk Action
Bulk action components sit in a table toolbar and operate on an array of selected rows. Each component is disabled when no rows are selected and emits success/error events so the parent can refresh data and clear the selection.
Components
<XABulkActionExport />
Exports the selected rows to CSV (always available) or JSON (when enableJson is set). Shows a dropdown to choose format when JSON is enabled; otherwise renders a single button that triggers CSV download directly. Fires a toast notification on export and emits the export event with the format and file content.
<XABulkActionExport
:selected="selectedRows"
:columns="[
{ key: 'name', label: 'Name' },
{ key: 'email', label: 'Email' },
{ key: 'status', label: 'Status' },
]"
filename="users-export"
enable-json
/>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
selected | unknown[] | — | Required. Array of selected row data objects. |
columns | ExportColumn[] | — | Required. Column definitions: { key, label, formatter? }. |
filename | string | 'export' | File name without extension. |
label | string | 'Export' | Button label text. |
showLabel | boolean | true | Show label text on the button. |
enableJson | boolean | false | Add a JSON export option to a dropdown menu. |
disabled | boolean | false | Force-disable the button regardless of selection. |
Emits
| Event | Payload | Description |
|---|---|---|
export | (format: 'csv' | 'json', content: string) | Fired after a successful export with the generated file content. |
AI Context
component: XABulkActionExport
package: "@xenterprises/nuxt-x-app"
category: BulkAction
use-when: >
User has selected one or more rows in a data table and needs to export
the selection. Place in the table toolbar alongside the selection checkbox.
Automatically disabled when selected array is empty.
patterns:
- Accepts a selected array and disables itself when it is empty
- Pass columns with key/label (and optional formatter) for CSV column control
