@hesapkurdu/react-drop-zone
v1.2.3
Published
Package to upload and convert files with drop zone
Downloads
9
Readme
React Drop Zone
Package to upload and convert files with drop zone
Installation
Use node package manager to install @hesapkurdu/react-drop-zone.
npm i @hesapkurdu/react-drop-zone
Basic Usage
import { DropZone, useDropZone } from '@hesapkurdu/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, triggerMethod, 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} />;
};