npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

velvet-image-dropzone

v1.1.1

Published

A lightweight, developer-friendly React image upload component with drag-and-drop, previews, cropping, multi-upload, and validation — built for React 18 & 19.

Readme

Velvet Dropzone

npm version npm downloads bundle size license sponsor

A modern, lightweight React image upload component. Drag-and-drop, previews, cropping, multi-upload, and validation — with a clean API and a look that fits right into any product.

Built for admin dashboards, CMSs, profile editors, e‑commerce platforms, and SaaS apps. Integrate image uploads in minutes.

npm install velvet-image-dropzone

Features

  • ✨ Drag & drop upload
  • 🖼️ Image preview
  • ✂️ Built-in cropping (no extra dependency)
  • 📁 Multiple image upload
  • 📏 File size validation
  • 📄 File type validation
  • ⚡ Lightweight — zero runtime dependencies
  • 🎨 Customizable UI via CSS variables or a render prop
  • 📱 Responsive
  • ♿ Accessibility friendly (keyboard operable, ARIA roles)
  • 🔒 TypeScript support
  • 🎯 React 18 & React 19 compatible

Quick start

import { VelvetDropzone } from "velvet-image-dropzone";
import "velvet-image-dropzone/styles.css";

function AvatarUploader() {
  return (
    <VelvetDropzone
      maxFiles={1}
      maxSize={5 * 1024 * 1024}
      enableCrop
      cropAspects={[{ label: "Square", value: 1 }]}
      onFilesChange={(files) => console.log(files)}
    />
  );
}

Multiple images with validation

<VelvetDropzone
  multiple
  maxFiles={8}
  accept={["image/png", "image/jpeg", "image/webp"]}
  maxSize={10 * 1024 * 1024}
  label="Drop product photos here"
  helperText="PNG, JPG or WEBP — up to 10MB each"
  onFilesChange={(files) => setPhotos(files)}
  onError={(errors) => errors.forEach((e) => toast.error(e.message))}
/>

Full control with a render prop

Use the render prop to build fully custom UI while Velvet Dropzone handles the drag events, validation, and file state.

<VelvetDropzone maxFiles={4} multiple>
  {({ isDragActive, files, openFileDialog }) => (
    <div className={isDragActive ? "zone zone--active" : "zone"} onClick={openFileDialog}>
      {files.length === 0 ? "Click or drop images" : `${files.length} image(s) selected`}
    </div>
  )}
</VelvetDropzone>

Props

| Prop | Type | Default | Description | | --- | --- | --- | --- | | onFilesChange | (files: VelvetFile[]) => void | — | Fires whenever the accepted file list changes. | | onError | (errors: VelvetValidationError[]) => void | — | Fires for every rejected file. | | onCropComplete | (id: string, blob: Blob) => void | — | Fires when a crop is confirmed. | | accept | string[] | common image types | Accepted MIME types (image/* patterns supported). | | maxSize | number | 5 * 1024 * 1024 | Max file size in bytes. | | maxFiles | number | 1 | Max number of files. | | multiple | boolean | maxFiles > 1 | Allow selecting/dropping more than one file at a time. | | disabled | boolean | false | Disables all interaction. | | enableCrop | boolean | false | Shows a crop action on each preview. | | cropAspects | CropAspect[] | Free / Square / 4:3 / 16:9 | Aspect ratio options in the cropper. Ignored when cropShape is "round". | | cropShape | "rect" \| "round" | "rect" | "round" forces a 1:1 circular crop — ideal for avatars. | | autoCropOnSelect | boolean | false | Opens the crop UI immediately after a file is picked/dropped. | | outputFormat | "image/png" \| "image/jpeg" \| "image/webp" | "image/png" | Encoding used for the cropped output blob. | | outputQuality | number | 0.92 | Encoding quality (0–1) for lossy formats. | | showFileList | boolean | true | Shows the row of file thumbnails below the dropzone. | | label | string | "Drag & drop images here" | Primary copy inside the dropzone. | | helperText | string | auto-generated | Secondary copy inside the dropzone. | | className / style | — | — | Passed to the root element. | | children | render prop | — | Take over rendering entirely. |

Theming

Every color, radius, and spacing token is a CSS variable scoped to .vd-root, so you can restyle the component without overriding specificity:

.vd-root {
  --vd-accent: #16a34a;
  --vd-radius: 8px;
  --vd-border: #d4d4d8;
}

TypeScript

Velvet Dropzone is written in TypeScript and ships its own declarations — no @types package needed. Import VelvetFile, VelvetDropzoneProps, VelvetValidationError, and CropAspect directly from velvet-image-dropzone.

Support this project

If Velvet Dropzone saves you time, consider sponsoring the project — it directly funds maintenance and new features. 💜

License

MIT