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

@lkekana/dropzone

v0.0.1

Published

Simple file drag & drop in React. Inspired by `react-dropzone`.

Downloads

95

Readme

dropzone

Simple file drag & drop in React. Inspired by react-dropzone.

Installation

npm install @lkekana/dropzone

Why?

While working on an Electron app, I discovered that react-dropzone's event handling prevented Electron from being able to determine the full file path of dropped files (see issue here), which I needed in order to open the files in my app.

I created this package to provide a simple drag & drop solution, inspired by react-dropzone, to get around the issue.

Peer Dependencies

This package requires React 18+:

npm install react@^18.0.0

Usage

import * as React from "react";
import { useDropzone } from "@lkekana/dropzone";

export function MyComponent() {
	const { getRootProps, getInputProps, isDragActive } = useDropzone({
		dialogAccept: ".png,.jpg,.jpeg",
		maxFiles: 5,
		onDrop: (files) => {
			console.log("Dropped/selected files:", files);
		},
	});

	return (
		<div
			{...getRootProps({
				style: {
					border: "2px dashed #ccc",
					padding: 16,
					borderRadius: 8,
				},
			})}
		>
			<input {...getInputProps()} />

			{isDragActive ? (
				<p>Drop files…</p>
			) : (
				<p>Drag & drop files here, or click to select</p>
			)}
		</div>
	);
}

API

useDropzone(options?)

  • disabled?: boolean: disable drag/click/open
  • allowMultiple?: boolean: allow selecting multiple files via dialog
  • dialogOnClick?: boolean: open dialog on click (default: true)
  • dialogOnDoubleClick?: boolean: open dialog on double click (default: false)
  • allowDrag?: boolean: enable drag-and-drop (default: true)
  • dialogAccept?: string: passed to <input accept="..."> (does not filter dropped files)
  • maxFiles?: number: return only the first N files
  • onDrop?(files, event): called on drop or dialog selection
  • onDragEnter?(event): called when a drag enters the dropzone
  • onDragOver?(event): called when a drag is over the dropzone
  • onDragLeave?(event): called when a drag leaves the dropzone
  • onFileDialogOpen?(): called when the file dialog is opened
  • onFileSelected?(files): called when files are selected via the dialog only (not called on drop)

Returns:

  • isDragActive: boolean: boolean state indicating if a file drag is active over the dropzone (only if item.kind === "file" in the drag event)
  • rootRef: React.RefObject, inputRef: React.RefObject: React refs for the root element and hidden file input, respectively
  • open(): programmatically open the file dialog
  • getRootProps(props?): get props to spread on the root <div> element. accepts any additional props to merge (e.g. style, className, etc.)
  • getInputProps(props?): get props to spread on the hidden <input type="file"> element. accepts any additional props to merge (e.g. accept, multiple, etc.)

Special Thanks

License

MIT License 📄 - See LICENSE for details