Documentation

CSV Export (beta)

SimpleTable makes it easy to export your table data to CSV format with just one method call. Using the tableRef and the exportToCSV() method, users can download their data for analysis, reporting, or sharing.

Basic Usage

To enable CSV export in your table, follow these steps:

  1. Create a table reference - Create a ref using useRef and pass it to the tableRef prop
  2. Add an export button - Create a button or trigger that calls the export method
  3. Call exportToCSV() - Invoke tableRef.current?.exportToCSV() to download the CSV file

CSV Export Configuration

PropertyRequiredDescriptionExample
tableRef
React.RefObject<TableRefType>
Required
React ref object that provides access to table methods including exportToCSV. Pass this ref to the SimpleTable component to enable CSV export functionality.
exportToCSV
(props?: { filename?: string }) => void
Optional
Method to export table data to CSV format. Call via tableRef.current?.exportToCSV(). Optionally pass a filename parameter.

The exported CSV includes all visible columns and respects active filters/sorting. Default filename is table-export.csv. Customize with exportToCSV({ filename: "my-file.csv" }).