DropZone is a component creating a drop zone area taking the full size of its parent element. It supports dropping files, HTML content or any other HTML drop event.
import { DropZone } from '@wordpress/components';
LinksPermalink to this section
PropsPermalink to this section
| Name | Default | Description |
|---|---|---|
className |
A CSS | |
icon | upload |
An icon to be shown within the drop zone area. |
label | `__( 'Drop files to upload' )` |
A string to be shown within the drop zone area. |
onDrop |
The function is generic drop handler called if the | |
onFilesDrop |
The function is called when dropping a file into the | |
onHTMLDrop |
The function is called when dropping HTML into the | |
isEligible | () => true |
A function to determine if the drop zone is eligible to handle the drop data transfer items. |
ExamplesPermalink to this section
DefaultPermalink to this section
const Default = ( props ) => {
return (
<div
style={ {
background: 'lightgray',
padding: 32,
position: 'relative',
} }
>
Drop something here
<DropZone { ...props } />
</div>
);
};