Skip to main content

Interface: DropZoneProps

Defined in: react/src/components/DropZone/index.tsx:6

Properties​

accept?​

optional accept?: string;

Defined in: react/src/components/DropZone/index.tsx:17

Which files to take, written the way the accept attribute of a file input is: a comma separated list of extensions (.wav), MIME types (audio/wav) and type groups (audio/*).

What does not match goes to onReject rather than onDrop. While the drag is still in the air the element is marked [data-invalid], as far as the browser lets it be told apart — a rule written as an extension cannot be decided until the drop.


children​

children: ReactNode;

Defined in: react/src/components/DropZone/index.tsx:48

What the zone shows.


disabled?​

optional disabled?: boolean;

Defined in: react/src/components/DropZone/index.tsx:31

Refuse the drop. The drag is still swallowed rather than let through: an unhandled drop makes the browser leave the page and open the file.

Default​

false

multiple?​

optional multiple?: boolean;

Defined in: react/src/components/DropZone/index.tsx:24

Take more than one file from a single drop. With it off, only the first accepted file is reported, as a file input without multiple does.

Default​

false

onDrop?​

optional onDrop?: (files, event) => void;

Defined in: react/src/components/DropZone/index.tsx:39

Called with the dropped files that match accept.

Parameters​

ParameterTypeDescription
filesFile[]-
eventDragEventthe drop, for anything the files leave out — where on the element it landed, most of all.

Returns​

void


onReject?​

optional onReject?: (files, event) => void;

Defined in: react/src/components/DropZone/index.tsx:45

Called with the dropped files that do not match accept, so that the reason can be shown. It comes after onDrop for the same drop, so a list of rejected files can be cleared in onDrop and filled here.

Parameters​

ParameterType
filesFile[]
eventDragEvent

Returns​

void