Socket
Socket
Sign inDemoInstall

@rpldy/upload-drop-zone

Package Overview
Dependencies
4
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpldy/upload-drop-zone


Version published
Maintainers
1
Created

Changelog

Source

0.8.3 (2021-01-07)

Bug fixes

  • [uploader] - respect filesParamName in upload options. Fix for #117

Internal

  • [retry] - use item finalize event instead of error & abort
  • e2e - added uploady custom filesParamName spec

Readme

Source
npm version circleci status codecov status bundlephobia badge rpldy storybook

Upload Drop Zone

Drop zone (container) component to initiate file and folder content uploads Supports individual files as well as recursively iterating over a dropped directory to upload its contents.

Uses html-dir-content to process the files/directories in the dnd events (DataTransferItem).

Can easily be combined with other D&D solutions.

Drop Zones can use different configuration overrides that supersede the options passed to the parent Uploady.

Note: Some options cannot be overriden by the button. For example, any prop that influences the file input directly (such as 'multiple')

Installation

#Yarn: 
   $ yarn add @rpldy/uploady @rpldy/upload-drop-zone 

#NPM:
   $ npm i @rpldy/uploady @rpldy/upload-drop-zone 

Props

Name (* = mandatory)TypeDefaultDescription
idstringundefinedid attribute to pass to the container element
classNamestringundefinedthe class attribute to pass to the container element
onDragOverClassNamestringundefinedclass name to add to the container when dragged over
dropHandlerDropHandlerMethodundefinedoverride default handler that returns the drop result (ex: files). May return a promise
htmlDirContentParamsObjectundefinedwill be passed as is to html-dir-content. See docs
childrenReact.Nodeundefinedchild element(s) to render inside the container
extraPropsObjectundefinedany other props to pass to the div component (with spread)

In addition, most UploadOptions props can be passed to UploadDropZone. In order to override configuration passed to the parent Uploady component. See Uploady documentation for detailed list of upload options.

Example

Simple example, shows how upload options can be passed to the drop-zone (grouped, maxGroupSize).


import Uploady from "@rpldy/uploady";
import UploadDropZone from "@rpldy/upload-drop-zone";

const App = () => (
    <Uploady destination={destination}>
        <UploadDropZone onDragOverClassName="drag-over"
                        grouped={grouped}
                        maxGroupSize={groupSize}>
            <span>Drag&Drop File(s) Here</span>            
        </UploadDropZone>
    </Uploady>);

See story showing how to use a 3rd library: react-dnd together with @rpldy/upload-drop-zone.

Keywords

FAQs

Last updated on 07 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc