Dropzone
The Dropzone component adds drag, drop, and paste handling to a container. It passes the selected FileList to onChange and applies Payload's drop-target styles.
Import
Basic usage
Dropzone does not render a file input or open the system file picker. Render those controls as children when users should be able to browse for files in addition to dropping them.
When multipleFiles is disabled, dropping more than one file passes only the first file to onChange.
Common props
These are the props most commonly used with this component. See its exported types in @payloadcms/ui for the complete list.
Prop | Type | Default | Description |
|---|---|---|---|
| | — | Content and file-selection controls in the target. |
| | — | Runs when files are dropped, pasted, or supplied. |
| | | Allows more than one file to be returned. |
| | | Disables drag, drop, and paste listeners. |
| | | Enables or removes Payload's drop-target styles. |
| | — | Adds a class to the dropzone container. |
* An asterisk denotes that a prop is required.
Was this page helpful?