Filedrop hawaii4/27/2023 file-drop-target.file-drop-dragging-over-target: This class will be added to the target whenever the user begins dragging a file over the target, and it will be removed when they leave Props file-drop-target.file-drop-dragging-over-frame: This class will be added to the target whenever the user begins dragging a file over the frame, and it will be removed when they leave file-drop-target: This is the target the user has to drag their files to. You can grab the demo CSS to get started.įor custom class names (if you're using something like JSS) you can use the following props: Stylingīy default, the component comes with no styles. Below you can find instruction how to do that. You can also define an onTargetClick prop if you want to let user browse their files from disk. Next, define an onDrop prop, whenever a user drops their files onto the target, this callback will be triggered. Import from 'react-file-drop' How it worksįirst, you define the frame prop (default is the document), whenever the user begins dragging file(s) anywhere over this frame, the target will get a file-drop-dragging-over-frame class name, and the onFrameDragEnter callback will fire. None! (well, just prop-types, but that should already be removed from your prod bundle anyway) Browser support I couldn't find any React component that already did this, so, I made one! Dependencies have where a part of the page highlights immediately when you start dragging a file anywhere on the window. I wanted that behavior that facebook, gmail, etc. A very simple live demo with example code and sample CSS Why? Drag files anywhere onto the window (or user defined 'frame' prop)! Very extensible, provides a hook for every event so you can use it to develop any custom behavior that you want. Zero dependency React component for Gmail or Facebook -like drag and drop file uploader.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |