Export — CSV/Excel/print
Prop enableExport — engine behaviour, default false.
Guide
When to use it
Let users take the data out — CSV, Excel or print. The master switch for all three.
How it works
Dependency-free: the engine ships its own toCsv / toXlsx (a real .xlsx — store-only ZIP +
OOXML, no exceljs) / buildPrintHtml, exposed as runtime.exportCsv / exportExcel /
printTable. Output covers all pages (pre-pagination) and is formatted per cell type, so it
matches the screen.
Gotchas
- Turn on the toolbar menu with
showExport. - Narrow the formats with the sub-toggles
enableCsvExport/enableExcelExport/enablePrint. - Always shown in the settings sheet ("Export").
Live example
Example source
import React from 'react'
import { BstTableMui } from '@bloomskill/table-mui'
import type { BstTableColumn } from '@bloomskill/table-engine'
import '@bloomskill/table-engine/styles.css'
type Row = { id: string; name: string; team: string; role: string; score: number }
const seed: Row[] = [
{ id: '1', name: 'Ada Lovelace', team: 'Platform', role: 'Engineer', score: 92 },
{ id: '2', name: 'Alan Turing', team: 'Research', role: 'Scientist', score: 88 },
{ id: '3', name: 'Grace Hopper', team: 'Platform', role: 'Engineer', score: 95 },
{ id: '4', name: 'Katherine J.', team: 'Research', role: 'Analyst', score: 90 },
{ id: '5', name: 'Edsger Dijkstra',team: 'Platform', role: 'Architect',score: 84 },
]
const columns: BstTableColumn<Row>[] = [
{ id: 'name', accessorKey: 'name', header: 'Name' },
{ id: 'team', accessorKey: 'team', header: 'Team' },
{ id: 'role', accessorKey: 'role', header: 'Role' },
{ id: 'score', accessorKey: 'score', header: 'Score', sortFn: 'basic' },
]
export default function App() {
return (
<BstTableMui data={seed} columns={columns} getRowId={(r) => r.id}
enableExport showExport />
)
}
Overview
| Layer | enable* (engine, resolved in useBstTable) |
| Type | boolean | BstExportOptions |
| Default | false |
| Maps to | custom — dep-free toCsv / toXlsx (store-only ZIP + OOXML, no exceljs) / buildPrintHtml; runtime.exportCsv/exportExcel/printTable. Scope defaults to all pages (pre-pagination); values formatted per cell type (match copy). In settings ("Export", always shown) |
| Status | ✅ done |
| Since | v0.34.0 |
| Settings sheet | Export |
Export — download the grid as CSV / Excel (.xlsx) or open a print view. true enables all three; pass a {@link BstExportOptions} object to choose formats and set the file name / row scope (an object implies enabled, §12). Opt-in. Default false. Adapters render an "Export" toolbar menu (showExport); drive it programmatically via runtime.exportCsv / runtime.exportExcel / runtime.printTable. Dependency-free — the .xlsx is a hand-built OOXML package, no exceljs.
Enable it
<BstTableMui
data={rows}
columns={columns}
enableExport={/* boolean | BstExportOptions */}
/>
Swap
BstTableMuiforBstTableShadcn(and the CSS import) for the shadcn skin — same props.
Behavior & interactions
- Off by default.
trueenables CSV + Excel + Print; pass aBstExportOptionsobject to pick formats / file name / row scope. Drivesruntime.exportCsv/exportExcel/printTable; adapters render an "Export" toolbar menu (showExport). Dependency-free — the.xlsxis a hand-built OOXML package, no exceljs.