OrJDev / solid-dropzone

React Dropzone Adapter For SolidJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Solid DropZone

SolidJS Adapter For React DropZone

Info

I was working on a SolidJS adapter for UploadThing, noticed it was using React DropZone so I was looking for a SolidJS DropZone adapter and faced an issue with the existing one where it was not working and threw an error (attr-etc is not installed), so i copied the code of it and made a few changes to make it work + used my own build config. The repo is here so thanks to the original author.

Install

pnpm install solidjs-dropzone

Usage

import { createDropzone } from "solidjs-dropzone";

function MyDropzone() {
  const onDrop = (acceptedFiles: File[]) => {
    // Do something with the files
  };
  const { getInputProps, getRootProps, isDragActive } = createDropzone({
    onDrop,
  });
  return (
    <div {...getRootProps()}>
      <input {...getInputProps()} />
      {isDragActive ? (
        <p>Drop the files here ...</p>
      ) : (
        <p>Drag 'n' drop some files here, or click to select files</p>
      )}
    </div>
  );
}

About

React Dropzone Adapter For SolidJS


Languages

Language:TypeScript 98.8%Language:JavaScript 1.2%