Title: DropZone
Published: March 9, 2021
Last modified: October 14, 2026

---

# DropZone

## In this article

 * [Usage](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#usage)
 * [Props](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#props)
    - [className](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#classname)
    - [label](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#label)
    - [onFilesDrop](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#onfilesdrop)
    - [onHTMLDrop](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#onhtmldrop)
    - [onDrop](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#ondrop)

`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.

## 󠀁[Usage](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#usage)󠁿

    ```language-jsx
    import { useState } from 'react';
    import { DropZone } from '@wordpress/components';

    const MyDropZone = () => {
        const [ hasDropped, setHasDropped ] = useState( false );

        return (
            <div>
                { hasDropped ? 'Dropped!' : 'Drop something here' }
                <DropZone
                    onFilesDrop={ () => setHasDropped( true ) }
                    onHTMLDrop={ () => setHasDropped( true ) }
                    onDrop={ () => setHasDropped( true ) }
                />
            </div>
        );
    }
    ```

## 󠀁[Props](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#props)󠁿

The component accepts the following props:

### 󠀁[className](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#classname)󠁿

A CSS `class` to give to the wrapper element.

 * Type: `String`
 * Default: `undefined`

### 󠀁[label](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#label)󠁿

A string to be shown within the drop zone area.

 * Type: `String`
 * Default: `Drop files to upload`

### 󠀁[onFilesDrop](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#onfilesdrop)󠁿

The function is called when dropping a file into the `DropZone`. It receives an 
array of dropped files as an argument.

 * Type: `Function`
 * Required: No
 * Default: `noop`

### 󠀁[onHTMLDrop](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#onhtmldrop)󠁿

The function is called when dropping HTML into the `DropZone`. It receives the HTML
being dropped as an argument.

 * Type: `Function`
 * Required: No
 * Default: `noop`

### 󠀁[onDrop](https://developer.wordpress.org/block-editor/reference-guides/components/drop-zone/?output_format=md#ondrop)󠁿

The function is generic drop handler called if the `onFilesDrop` or `onHTMLDrop`
are not called. It receives the drop `event` object as an argument.

 * Type: `Function`
 * Required: No
 * Default: `noop`

First published

March 9, 2021

Last updated

October 14, 2026

Edit article

[ Improve it on GitHub: DropZone ](https://github.com/WordPress/gutenberg/edit/trunk/packages/components/src/drop-zone/README.md)

[  Previous: Draggable](https://developer.wordpress.org/block-editor/reference-guides/components/draggable/)

[  Next: DropdownMenu](https://developer.wordpress.org/block-editor/reference-guides/components/dropdown-menu/)