![]() ![]() ![]() OnFrameDrop: function(event): Callback when the user drops files anywhere over the frame.ĬlassName: string (default: "file-drop"): Class given to the outer container div. OnFrameDragLeave: function(event): Callback when the user stops dragging over the frame. OnFrameDragEnter: function(event): Callback when the user begins dragging over the frame. ![]() Not available in IE :(įrame: document || HTMLElement (default: document): This is the scope or "frame" that the user must drag some file(s) over to kick things off. OnTargetClick: function(event): Callback when the user clicks anywhere on the target.ĭropEffect - string "copy" || "move" || "link" || "none" (default: "copy"): Learn more about HTML5 dropEffects. Removes the file-drop-dragging-over-target class from the file-drop-target. ![]() OnDragLeave: function(event): Callback when the user leaves the target. Also adds the file-drop-dragging-over-target class to the file-drop-target. OnDragOver: function(event): Callback when the user is dragging over the target. OnDrop: function(files, event): Callback when the user drops files onto the target 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. The server can optionally return a JSON response to indicate a successful upload.Zero dependency React component for Gmail or Facebook -like drag and drop file uploader. In which case Slim automatically uploads images. Slim ships with an example upload PHP file which is also used on this website (async.php).Īn upload button will appear unless the data-push property is set to "true". When set, the cropped image will be sent to the set URL using AJAX. Takes a value between 0 and 100, best subtle results are achieved with values between 10 and 20. This can lead to a slight improvement in image clarity. Slim can sharpen images after they've been resized, this can be used to highlight colors and high contrast edges. Set to "false" to allow output images to be smaller than required input. Determine the forced output size of the resulting image.įor example "320,320" will scale the image to fit those dimensions.įorce size will also set the aspect ratio to fit the supplied size, so with force-size set to "320,320" this would be "1:1".īy default Slim does not resize the output image. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |