mui-dropzone
a File Drop Zone component that uses Material-UI components for style. Also includes Excel and File helper functions.
Install
npm install --save mui-dropzone @material-ui/core xlsx#or yarn add mui-dropzone @material-ui/core xlsx
Usage
FileDropZone
; Component { console; } { console; } { return <FileDropZone acceptedMimeTypes=excelexcelMimeTypes onFilesAdded=thisonFilesAdded onFilesRejected=thisonFilesRejected elevation=2 dragOverElevation=10 /> }
Other Properties:
message
: set the message displayed in the dropzonedragOverMessage
: set the message displayed when a file is dragged over the dropzoneacceptedExtensions
: similar toacceptedMimeTypes
, but looks at file extension. not mutually exclusive withacceptedMimeTypes
.blockOtherDrops
: disallows any file drop events on the page anywhere but the dropzone. Useful to prevent users from dropping files in the wrong area.dragOverClassName
: set the classname when a file is dragged over the dropzone. This will replace the className property
excel
a module with excel file helpers.
; //get file from FileDropZone onFilesAdded eventlet data = await excel;//data will be a dictionary with a key per worksheet in the workbook. First row of each will be treated as column headers
files
a module with javascript file helpers.
; let buff = await files;let text = await files;
License
MIT © curtisrutland
Details
Bootstrapped with Create-React-Library