Dropzone

A file upload area that supports drag and drop, click to browse, file previews, and removal. Built with compound components for maximum composability.

Import

Usage

Custom Heading

Custom Description

Custom Icon

Image upload

Document upload

Accept File Types

Max Files

Error State

Disabled

Component Placement

Previews above area

Area only

Error between area and previews

Custom Implementation

Upload up to 5 screenshots that might be relevant.
Max file size: 10 MB each.

Full Composition

Data Attributes

  • -
    data-slot="dropzone"Root dropzone element identifier
  • -
    data-slot="dropzone-area"Interactive drop/click area identifier
  • -
    data-slot="dropzone-icon"Icon wrapper element identifier
  • -
    data-slot="dropzone-heading"Heading text element identifier
  • -
    data-slot="dropzone-description"Description text element identifier
  • -
    data-slot="dropzone-previews"File preview list container identifier
  • -
    data-slot="dropzone-file"Individual file preview item identifier
  • -
    data-slot="dropzone-error"Error message element identifier

Accessibility

Keyboard Support

  • -
    Enter / SpaceOpens the file picker dialog when the drop area is focused
  • -
    TabMoves focus to the drop area or the next focusable element

ARIA Attributes

  • -
    roleThe drop area uses role='presentation' with an internal input for screen reader access
  • -
    aria-label="Remove {filename}"Each file preview remove button has a descriptive label for assistive technology
  • -
    role="alert"Error messages use role='alert' with aria-live='polite' for screen reader announcements

Dropzone Props

AttributeTypeDefaultDescription
filesFile[]-Controlled file list.
onFilesChange(files: File[]) => void-Callback when the file list changes.
onReject(rejections: FileRejection[]) => void-Callback fired with file rejections (e.g. exceeding maxSize or invalid type).
acceptRecord<string, string[]>-Accepted file types using MIME type keys and extension arrays. E.g. { "image/*": [".png", ".jpg"] }.
maxFilesnumber5Maximum number of files that can be uploaded. The drop area hides when the limit is reached.
maxSizenumber10485760Maximum file size in bytes (default 10 MB). Files exceeding this are rejected.
minSizenumber-Minimum file size in bytes.
disabledbooleanfalseWhether the dropzone is disabled.
isInvalidbooleanfalseWhether the dropzone is in an error state.
errorMessagestring-Error message displayed by DropzoneError when isInvalid is true.
childrenReact.ReactNode<DropzoneArea /> + <DropzonePreviews /> + <DropzoneError />Compound children. Defaults to DropzoneArea, DropzonePreviews, and DropzoneError when omitted.
classNamestring-Additional CSS classes for the root container.

DropzoneArea Props

AttributeTypeDefaultDescription
childrenReact.ReactNode<DropzoneIcon /> + <DropzoneHeading /> + <DropzoneDescription />Compound children. Defaults to DropzoneIcon, DropzoneHeading, and DropzoneDescription when omitted.
classNamestring-Additional CSS classes for the drop area.

DropzoneIcon Props

AttributeTypeDefaultDescription
childrenReact.ReactNode<Upload />Custom icon content. Defaults to an Upload icon.
classNamestring-Additional CSS classes for the icon wrapper.

DropzoneHeading Props

AttributeTypeDefaultDescription
childrenReact.ReactNode"Click to upload or drag and drop"Heading text. Defaults to context-aware text that changes during drag events.
classNamestring-Additional CSS classes for the heading.

DropzoneDescription Props

AttributeTypeDefaultDescription
childrenReact.ReactNode"Upload up to {maxFiles} files. Max {maxSize} each."Description text. Defaults to auto-generated text from context.
classNamestring-Additional CSS classes for the description.

DropzonePreviews Props

AttributeTypeDefaultDescription
classNamestring-Additional CSS classes for the previews container.

DropzoneError Props

AttributeTypeDefaultDescription
messagestring-Override the error message from context. Falls back to errorMessage from the root Dropzone.
classNamestring-Additional CSS classes for the error message.