Skip to main content

Export Menu

A dropdown menu for exporting data in various formats.

Preview · Export Menu

Code​

<div class="hstack">
<button class="outline small">Export â–¾</button>
<div class="card" style="padding:0.25rem;min-width:140px">
<button class="ghost" style="width:100%;justify-content:flex-start;font-size:0.8rem;padding:0.5rem 0.75rem">Export CSV</button>
<button class="ghost" style="width:100%;justify-content:flex-start;font-size:0.8rem;padding:0.5rem 0.75rem">Export PDF</button>
<button class="ghost" style="width:100%;justify-content:flex-start;font-size:0.8rem;padding:0.5rem 0.75rem">Export Excel</button>
</div>
</div>

Props​

PropTypeDefaultDescription
formatsExportFormat[]['CSV']Available export formats
includeChartsbooleanfalseInclude chart images in PDF export
includeStatsbooleantrueInclude stat cards in export
includeTablesbooleantrueInclude data tables in export
onExport / (exportTriggered)(payload: ExportPayload) => voidrequiredFires when a format is selected

TypeScript interfaces​

type ExportFormat = 'CSV' | 'Excel' | 'PDF' | 'JSON';

interface ExportPayload {
format: ExportFormat;
includeCharts: boolean;
includeStats: boolean;
includeTables: boolean;
requestedAt: string; // ISO timestamp
}

// Example
<PrimusExportMenu
formats={['CSV', 'Excel', 'PDF']}
includeCharts
onExport={(payload) => {
if (payload.format === 'CSV') downloadCsv(data);
if (payload.format === 'PDF') generatePdf({ ...payload });
}}
/>
Version history

See the Changelog for version history and breaking changes.