Installation
Usage
Props
Callback fired when file upload completes successfully
Callback fired when file upload fails validation or encounters an error
Array of accepted MIME types (e.g.,
["image/png", "image/jpeg"])Maximum file size in bytes. Defaults to 5MB (5 * 1024 * 1024)
Currently selected file for controlled component usage
Callback fired when user removes the selected file
Duration in milliseconds for the upload simulation. Set to 0 to disable simulation
Custom validation function. Return a FileError object to reject the file
Additional CSS classes to apply to the component container
Features
- Drag and Drop: Full drag-and-drop support with visual feedback
- File Validation: Built-in validation for file type and size with custom validation support
- Animated States: Smooth animations for idle, dragging, uploading, and error states
- Progress Tracking: Visual progress indicator during upload simulation
- Error Handling: Clear error messages with auto-dismiss after 3 seconds
- Accessible: ARIA labels and semantic HTML for screen readers
Custom Validation
You can provide custom validation logic using thevalidateFile prop:
Dependencies
lucide-react- Icon componentsmotion(Framer Motion) - Animation libraryreact- Core React library