A dropdown-based export menu widget that lets users choose an export format, optionally select which fields to include, and trigger a download. Designed for data tables, reports, and dashboard exports across SaaS products.
Introduction
Overview
Data export is a recurring need in SaaS applications. Users expect to download table data, reports, or filtered views in formats like CSV, JSON, XLSX, or PDF. This widget provides a standardized export dropdown with format selection, optional field picking, and a download CTA.
Goals
Dropdown menu triggered by an export button.
Format picker supporting configurable format options (CSV, JSON, XLSX, PDF, etc.).
Optional field-selection checklist for choosing which columns/fields to export.
Download CTA that invokes a consumer callback with selected format and fields.
Ship Storybook stories covering format-only, with-field-selection, and loading states.
Non-Goals
Actual file generation (consumer produces the file blob or URL).
Server-side export orchestration.
Scheduled or recurring exports.
Email delivery of export files.
Scope
In Scope
Item
Description
ExportMenu component
Dropdown with format picker, field selector, and download CTA
Inconsistent export options across different tables and views
Product teams
Rebuilding export menus per feature with varying format support
End users
Not knowing which formats are available or what data will be included
Definitions
Term
Definition
Export format
The file type for the download (e.g., CSV, JSON, XLSX, PDF)
Field selection
A subset of available data columns the user chooses to include
Download CTA
The button that initiates the export/download action
Current State
No export menu widget exists. Products use ad-hoc dropdown menus or inline buttons for exports. The DropdownMenu primitive is available and can serve as the foundation.
Proposed Solution
Create an ExportMenu widget at src/components/widgets/export-menu.tsx that:
Renders a trigger button (configurable label, defaults to “Export”).
Opens a dropdown menu with format options as selectable items.
Optionally shows a field-selection checklist when fields prop is provided.
Includes a “Download” or “Export” CTA at the bottom of the dropdown.
Calls onExport with the selected format and fields.
Supports a loading state that shows a spinner on the CTA and disables interaction.
Requirements
The widget is a controlled dropdown that delegates all file generation to the consumer via callbacks. It must not trigger file downloads directly.
Functional Requirements
ID
Requirement
Priority
FR-01
Render a trigger button that opens the export dropdown
Must
FR-02
Display a list of format options with icons and labels
Must
FR-03
Allow single-select of a format (radio behavior)
Must
FR-04
Optionally display a field checklist with select-all/deselect-all
Should
FR-05
Render a download CTA button inside the dropdown
Must
FR-06
Call onExport({ format, fields }) when CTA is clicked
Must
FR-07
Support a loading prop that disables CTA and shows spinner
Must
FR-08
Support a disabled prop on the trigger button
Must
FR-09
Close the dropdown after successful export callback
Should
FR-10
Pre-select a default format via defaultFormat prop
Should
Non-Functional Requirements
ID
Requirement
NFR-01
Bundle size under 2 KB gzipped (excluding shared primitives)