This package contains the PRO Edition of SVAR React Export Popup, which provides extra export formats and customization for production projects.
Depending on the license you purchased, you are granted the right to use this package under one of the following commercial licenses:
If you have technical questions about using SVAR React Export Popup, you can use our SVAR forum or contact us at support@svar.dev (please provide your license number).
To use the widget, anchor it to a trigger element, choose which tabs to show, and handle the emitted export request through onExport:
import { useRef, useState } from 'react';
import { ExportPopup } from '@svar/react-export-popup';
import '@svar/react-export-popup/all.css';
export default function App() {
const anchor = useRef(null);
const [open, setOpen] = useState(false);
function handleExport(request) {
// request describes the chosen format and options, e.g.
// { format: 'pdf', skin: 'light', paper: { size: 'auto', landscape: false } }
fetch('/api/export', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(request),
});
setOpen(false);
}
return (
<>
<button ref={anchor} onClick={() => setOpen(true)}>
Export…
</button>
{open && (
<ExportPopup
title="Export"
tabs={['pdf', 'png', 'xlsx']}
parent={anchor.current}
onExport={handleExport}
onClose={() => setOpen(false)}
/>
)}
</>
);
}See the docs to learn how to configure tabs, page layout, Excel columns, custom export formats, and localization.