Dropzone

Dropzone is a component used for uploading files via drag and drop.

Usage

import { Dropzone } from "@yamada-ui/react"
<Dropzone.Root>
  <Dropzone.Title />
  <Dropzone.Description />
  <Dropzone.Accept>
    <Dropzone.Icon />
  </Dropzone.Accept>
  <Dropzone.Reject>
    <Dropzone.Icon />
  </Dropzone.Reject>
  <Dropzone.Idle>
    <Dropzone.Icon />
  </Dropzone.Idle>
</Dropzone.Root>

Change Variant

Change Size

Allow Multiple Selection

To allow multiple selection, set multiple to true.

Specify File Extensions

To specify file extensions, set accept to an array of strings or an object.

We also provide easy-to-use constants like IMAGE_ACCEPT_TYPE and PDF_ACCEPT_TYPE.

Specify Maximum File Size

To specify the maximum file size, set maxSize to a number (bytes).

Specify Maximum Number of Uploadable Files

To specify the maximum number of uploadable files, set maxFiles to a number.

Display According to Status

To control the display based on whether the file is accepted or rejected, use DropzoneAccept, DropzoneReject, DropzoneIdle.

  • DropzoneAccept: A component displayed when a file is accepted.
  • DropzoneReject: A component displayed when a file is rejected.
  • DropzoneIdle: A component displayed when in idle state.

Handle Dropped Event

To handle the selection event, use onDrop.

Handle Only Accepted Files

To handle only accepted files, use onDropAccepted.

Handle Only Rejected Files

To handle only rejected files, use onDropRejected.

Change Border Color

To change the border color, set focusBorderColor or errorBorderColor to a color.

Disable

To disable, set disabled to true.

Read-Only

To read-only, set readOnly to true.

Invalid

To set invalid state, set invalid to true.

File is required.

Use Loading Animation

To use a loading animation, set loading to true.

Control

Props

Accessibility

Currently, this section is being updated due to the migration of v2.