Import Modal
ImportModal provides a file upload interface for bulk-importing entities from CSV or Excel files.
Import
import { ImportModal } from "@phpcreation/frontend-crud-react-nextjs-bundle/components/ImportModal";Usage
import { ImportModal } from "...";
<ImportModal
open={importOpen}
onOpenChange={setImportOpen}
entityConfig={entityConfig}
importUrl="/api/invoices/import"
templateUrl="/api/invoices/import-template"
onSuccess={() => {
setImportOpen(false);
refetchListing();
}}
/>Props
| Prop | Type | Description |
|---|---|---|
open | boolean | Modal open state |
onOpenChange | (open: boolean) => void | Open state handler |
entityConfig | EntityConfig | Entity configuration |
importUrl | string | API endpoint for file upload (POST) |
templateUrl | string | URL to download the import template |
onSuccess | () => void | Called after successful import |
Download the import template first to see the expected column headers. The template is generated from the entity’s importable fields.
Related
Last updated on