FileUpload
Drag-and-drop file zone with size validation, accepted type filtering, and a selected-file list.
Preview
Default (single file)
Click to upload or drag and drop
Multiple images
Click to upload or drag and dropAccepted: image/*
Disabled
Click to upload or drag and drop
Usage
import { FileUpload } from "anexui";
<FileUpload
onChange={(files) => console.log(files)}
/>
Copy codeMultiple files
<FileUpload
multiple
onChange={(files) => setFiles(files)}
/>
Copy codeImage-only
<FileUpload accept="image/*" />
Copy codeWith max size
<FileUpload maxSize={5 * 1024 * 1024} /> {/* 5 MB */}
Disabled
<FileUpload disabled />
Copy codeProps
| Prop | Type | Default | Description |
|---|---|---|---|
| multiple | boolean | false | Allow selecting multiple files |
| accept | string | — | MIME type filter (e.g. "image/*", ".pdf") |
| maxSize | number | — | Maximum file size in bytes; oversized files are rejected |
| onChange | (files: File[]) => void | — | Called whenever the file selection changes |
| disabled | boolean | false | Disables drag-and-drop and the file picker |
| className | string | — | Extra class names on the root element |
| id | string | — | HTML id attribute |
| name | string | — | HTML form field name |