The Dropzone component provides a drag-and-drop interface for uploading files. It supports file validation (type, size, count), UI customization (header, footer, buttons), and flexible display options (file name, size, type).
1. Basic Properties
- Name: The unique identifier of the component (e.g.,
Dropzone1
). - Accept: Restricts file types (e.g.,
image/*
,.pdf
). - Disabled: Makes the dropzone non-interactive.
- Hidden: Hides the component from view but keeps it active in logic.
- Multiple: Allows multiple file uploads.
2. Layout
Defines responsiveness and spacing of the dropzone component.
π See Common Properties β Layout.
3. Events
- onChange: Triggered whenever a file is added, removed, or changed.
4. Validations
Validation rules ensure file uploads meet specific conditions:
- Max file size β Largest file size allowed (in bytes).
- Min file size β Smallest file size allowed (in bytes).
- Invalid file size messages β Custom error messages for exceeding limits.
- Invalid file extension message β Custom error message if the extension is not allowed.
- Allowed types β Displays the accepted file extensions or MIME types.
- File count message β Displays the number of uploaded files.
π See Common Properties β Validations.
5. Header
- Show: Toggles the header visibility.
- Title: Custom title text for the dropzone.
- Density: Controls dropzone sizing (
small
,medium
,large
).
6. Buttons
The dropzone supports customizable action buttons:
- Upload button β Edit label or style.
- Clear button β Remove all uploaded files.
- Delete button β Remove individual files.
- Download button β Download uploaded files.
7. Footer
- Show: Toggles the footer visibility.
- File Action: Enables file-related actions (delete, download, etc.).
- Position: Aligns footer elements (
left
orright
). - Width: Adjusts the footer width (px).
8. Messages
Customizable messages improve user experience:
- Dropzone message β Instruction text (e.g., βDrag & Drop the desired file or click to browse for a file insteadβ).
- File name label β Custom label for file name.
- File size label β Custom label for file size.
- File type label β Custom label for file type.
- All file types accepted message β Text shown when all file types are allowed.
9. Display Options
- Show file name β Displays uploaded file names.
- Show file size β Displays the size of uploaded files.
- Show file type β Displays the MIME type or extension of uploaded files.
10. Style
Custom styles can be applied for UI customization.
π See Common Properties β Style.
β The Dropzone component makes file uploading simple, flexible, and user-friendly, with powerful validation options and customizable UI elements.