Skip to content

mert-solak/react-drop-zone

Repository files navigation

React Drop Zone

Package to upload and convert files with drop zone

npm license size issue

Installation

Use node package manager to install @mertsolak/react-drop-zone.

npm i @mertsolak/react-drop-zone

Basic Usage

import { DropZone, useDropZone } from '@mertsolak/react-drop-zone';

const App = () => {
  // converted files will be available in files array
  // fileInDropZone can be used to style component when any file drag over the drop zone
  // fileList is the original list that comes from event
  // control needs to be given to the component to get updated states
  // 'File' is the default value for the getFilesAs, if it is not provided
  const { files, control, fileList, totalFileSize, errors, fileInDropZone } = useDropZone({
    getFilesAs: 'base64',
  });

  // default components can be overwritten with buttonComponent
  // and contentComponent or container style can be updated via className
  return <DropZone multiple accept={['.png']} control={control} />;
};

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published