Certainly! Here's how the README.md
content would look in a markdown format:
The DragDropzone
component is a versatile and highly customizable React component designed to allow users to drag and drop files for upload. It leverages Tailwind CSS for styling, and react-dropzone
for handling the dropzone functionality.
npm install @daveyplate/tailwind-drag-dropzone
Ensure you have Tailwind CSS configured properly in your project.
import { DragDropzone } from '@daveyplate/tailwind-drag-dropzone'
function App() {
const openRef = React.useRef()
const handleFiles = (files) => {
console.log('Files:', files)
// Handle file processing here
}
const handleError = (error) => {
console.error('Error:', error)
// Handle error processing here
}
return (
<div className="App">
<DragDropzone
size="md"
label="Upload Files"
openRef={openRef}
accept={{ 'image/*': [] }}
maxFiles={3}
onFiles={handleFiles}
onError={handleError}
>
<div>Drag your files here or click to upload.</div>
</DragDropzone>
</div>
)
}
react-dropzone
format. Default accepts all images.File
objects.error
object.This module is open-source and available under the ISC License.
Contributions, issues, and feature requests are welcome! Please feel free to check the issues page if you have questions or suggestions.
With this guide, you should be equipped to integrate and customize the DragDropzone
component in your projects effectively. Enjoy seamless file uploads with this convenient drag-and-drop interface!