FrontendInterviews.dev

Loading problem…

121. Data Table - CSV Export

Medium•
Acceptance: 69.00%
•
🔓3/3 Pro unlocks today

This problem builds on data-table-global-search. Complete that first, then load your solution to continue.

Build a production-ready Data Table component that extends the base Data Table with CSV export functionality. This builds on top of the sorting feature from the base Data Table.

Requirements

1. CSV Export

  • Export filtered/sorted data to CSV
  • Include column headers
  • Handle special characters (commas, quotes, newlines)
  • Download file with proper filename
  • Export button in UI

2. Data Structure

interface Column {
  key: string;
  label: string;
  sortable?: boolean;
}

interface DataTableProps {
  data: Record<string, any>[];
  columns: Column[];
  enableExport?: boolean;
}

Example Usage

<DataTable 
  data={data} 
  columns={columns}
  enableExport={true}
/>

Constraints

  • Export should respect current filters and sorting
  • Handle special characters in CSV format
  • Maintain sorting functionality from base Data Table