Skip to Content

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

PropTypeDescription
openbooleanModal open state
onOpenChange(open: boolean) => voidOpen state handler
entityConfigEntityConfigEntity configuration
importUrlstringAPI endpoint for file upload (POST)
templateUrlstringURL to download the import template
onSuccess() => voidCalled after successful import

Download the import template first to see the expected column headers. The template is generated from the entity’s importable fields.


Last updated on