Skip to main content
A comprehensive file upload component with drag-and-drop, validation, and upload progress tracking.

Import

Component Parts

component
Root provider with file upload state management
component
Drop zone container with drag-and-drop handlers
component
Hidden file input element
component
Combined container and input with context rendering
component
Button to open file picker
component
Container for uploaded files
component
Individual file list item
component
File preview (image or icon)
component
File name and size display
component
Upload progress indicator
component
Button to remove a file
component
Button to clear all files
component
Context consumer for accessing store state

DropZone.Root

Root provider that manages file upload state and validation.

Props

React.ReactNode
required
Child components
boolean
Whether the drop zone is disabled
boolean
Whether to allow multiple files to be uploaded
FileMeta | FileMeta[] | null
Initial files to populate the drop zone
boolean
default:false
Whether clicking the drop zone area will open the default file picker
boolean
default:false
Whether to disable the internal state subscription for data attributes. Useful if you want to subscribe to state yourself
boolean
default:true
Whether to disallow preview generation for non-image files
boolean
Set to true to disable the default styling

Validation Props

string | string[]
Accepted file types (MIME types or extensions)
number
Maximum number of files allowed
number
Maximum file size in bytes
number
Minimum file size in bytes
function
Custom validation function
If the function returns false, the file will be rejected

Callback Props

function
Callback fired when the internal files state changes
function
Callback fired when new files are uploaded
function
Callback fired on each file validation error
function
Callback fired after all files have been successfully validated

DropZone.Container

Drop zone container with drag-and-drop event handlers.

Props

React.ElementType
default:"div"
The element type to render as
boolean
Merge props with immediate child element
string
CSS class names to apply
boolean
Disable default styling

Data Attributes

  • data-scope="drop-zone"
  • data-part="container"
  • data-drag-over - Present when dragging over
  • data-invalid - Present when validation fails

DropZone.Input

Hidden file input element.

Props

boolean
Merge props with immediate child element
string
CSS class names to apply

Data Attributes

  • data-scope="drop-zone"
  • data-part="input"
  • data-drag-over - Present when dragging over

DropZone.Area

Convenience component combining Container and Input with context rendering.

Props

React.ReactNode | RenderFn
Child components or render function receiving store state
function
State selector function
string
CSS class names for container
object
Class names for parts
  • container?: string
  • input?: string
object
Additional props for parts
  • container?: object
  • input?: object
boolean
Disable default styling

DropZone.Trigger

Button to open the file picker.

Props

boolean
Merge props with immediate child element
string
CSS class names to apply

Data Attributes

  • data-scope="drop-zone"
  • data-part="trigger"

DropZone.FileList

Container for uploaded files with conditional rendering.

Props

React.ElementType
default:"ul"
The element type to render as
boolean
Merge props with immediate child element
boolean
default:false
Force mount even when no files are present
'per-item' | 'manual-list'
default:"per-item"
Rendering strategy
  • per-item - Render function called for each file
  • manual-list - Render function receives full array
React.ReactNode | RenderFn
Child components or render functionPer-item mode:
Manual-list mode:
'horizontal' | 'vertical'
List orientation for default styling
boolean
Disable default styling

Data Attributes

  • data-scope="drop-zone"
  • data-part="file-list"
  • data-state="active" | "inactive"

DropZone.FileItem

Individual file list item with file state context.

Props

React.ElementType
default:"li"
The element type to render as
boolean
Merge props with immediate child element
FileState
required
File state object for this item
string
CSS class names to apply
boolean
Disable default styling

Data Attributes

  • data-scope="drop-zone"
  • data-part="file-item"

DropZone.FileItemPreview

File preview component with automatic icon/image rendering.

Props

React.ElementType
default:"span"
The element type to render as
boolean
Merge props with immediate child element
FileState
File state object (optional if used within FileItem)
boolean | RenderPreviewObject | RenderPreviewFn
default:true
Preview rendering configuration
  • false - Disable preview
  • true - Use default preview
  • Object or function for custom rendering
React.ReactNode | RenderFn
Custom preview content or render function
boolean
Disable default styling

Data Attributes

  • data-scope="drop-zone"
  • data-part="file-item-preview"

DropZone.FileItemMetadata

File name and size display.

Props

boolean
Merge props with immediate child element
FileState
File state object (optional if used within FileItem)
'default' | 'sm'
default:"default"
Text size variant
object
Class names for metadata parts
  • name?: string - File name classes
  • size?: string - File size classes
React.ReactNode | RenderFn
Custom metadata content or render function
boolean
Disable default styling

Data Attributes

  • data-scope="drop-zone"
  • data-part="file-item-metadata"

DropZone.FileItemProgress

Upload progress indicator with multiple variants.

Props

React.ElementType
default:"span"
The element type to render as
boolean
Merge props with immediate child element
'linear' | 'circular' | 'fill'
default:"linear"
Progress indicator style
  • linear - Horizontal progress bar
  • circular - Circular progress ring
  • fill - Fill overlay effect
number
default:40
Size in pixels (circular variant only)
boolean
default:false
Force mount even when progress is 100%
boolean
Disable default styling

Data Attributes

  • data-scope="drop-zone"
  • data-part="file-item-progress"

DropZone.FileItemDelete

Button to remove a file from the list.

Props

boolean
Merge props with immediate child element
FileState | File | string
File to delete (optional if used within FileItem)
string
CSS class names to apply

Data Attributes

  • data-scope="drop-zone"
  • data-part="file-item-delete"

DropZone.FileClear

Button to clear all files.

Props

boolean
Merge props with immediate child element
boolean
default:false
Force mount even when no files are present
string
CSS class names to apply

Data Attributes

  • data-scope="drop-zone"
  • data-part="file-item-clear"

DropZone.Context

Context consumer for accessing drop zone state.

Props

React.ReactNode | RenderFn
required
Child components or render function
function
State selector function

Types

FileState

DropZoneStore

UseDropZoneResult

Hooks

useDropZone

useDropZoneStoreContext