File Upload
premiumSingle file upload with type and size validation.
Overview
The File Upload component lets users select or drag-and-drop a single file. Validates file type (by MIME type or extension) and file size with configurable limits.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
name | String | "file" | Field name used in form data. |
label | String | "Upload File" | Label displayed above the upload area. |
accept | String | -- | Accepted file types (e.g., ".pdf,.doc" or "image/*"). |
maxSize | Number | 5 | Maximum file size in MB. |
required | Boolean | false | Whether a file must be uploaded. |
Features
- Click or drag-and-drop file selection
- File type validation (MIME type or extension)
- File size validation (configured in MB)
- File preview with name and size display
- Remove button to clear selection
Tips
The maxSize property is in MB (e.g., 5 = 5MB).
Use accept to restrict file types: ".pdf,.doc" for specific extensions, "image/*" for all images.
Validation
This component uses file validation. See the Validation Guide for details on configuring rules and error messages.