Reusable component for uploading images with drag & drop functionality, preview grid, and file management
Drag images from your computer or click to browse
Drag & drop images here
or click to browse
PNG, JPG, GIF up to 10MB • 10 of 10 slots available
Drag image files from your computer and drop them onto the upload area.
Click anywhere in the upload area or the "Select Files" button to open your file browser.
Preview uploaded images in the grid. Hover over an image to see the remove button.
Copy image URLs for use in your pages, or copy as background style code.
onUploadCompleteFunction called when upload finishes with image URLs array
onChangeFunction called whenever images change (add/remove)
maxFilesMaximum number of files allowed (default: 5)
showPreviewShow/hide image preview grid (default: true)
initialImagesArray of initial image URLs to display
classNameAdditional CSS classes for styling
import ImageUploader from '../components/ImageUploader';
function MyComponent() {
const [images, setImages] = useState([]);
return (
<ImageUploader
onUploadComplete={(imageUrls) => {
setImages(imageUrls);
console.log('Uploaded:', imageUrls);
}}
maxFiles={5}
showPreview={true}
/>
);
}const [backgroundUrl, setBackgroundUrl] = useState('');
<ImageUploader
onUploadComplete={(urls) => {
if (urls.length > 0) {
setBackgroundUrl(urls[0]); // Use first image
}
}}
maxFiles={1}
/>
{/* Apply as background */}
<div
style={{
backgroundImage: `url(${backgroundUrl})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
minHeight: '400px'
}}
className="rounded-lg"
>
{/* Your content here */}
</div><ImageUploader
onChange={(updatedImages) => {
// Called on every change (add/remove)
console.log('Current images:', updatedImages);
}}
onUploadComplete={(newImages) => {
// Called only when upload completes
console.log('Upload finished:', newImages);
}}
maxFiles={10}
/><ImageUploader
onUploadComplete={(urls) => setImages(urls)}
showPreview={false}
maxFiles={3}
/>Priced to your vehicle — get a free quote in 30 seconds. Tell us your car and what it needs and we'll text you a personalized price.
/ Request your quote
Mobile detailing — we come to you. Fully insured. Satisfaction guaranteed.