DropArea component provides a drag-and-drop interface for file uploads. It displays visual feedback when files are dragged over it and can be configured as clickable to open the system file picker.
Overview
DropArea extendsLitUploaderBlock and creates an interactive drop zone for files. It supports dragging files from the desktop, dropping URLs, and can optionally act as a button to open the file selection dialog.
Basic Usage
With Custom Text
Clickable Drop Area
Properties
Makes the drop area clickable to open the file picker.When enabled, users can click or press Space/Enter to open the system file dialog.
Disables the drop area, preventing any interactions.
Shows an upload icon in the drop area.Displays a cloud upload icon with an arrow animation on drag hover.
Custom text to display in the drop area.If not provided, uses the localized default text “drop-files-here”.
Makes the drop area cover the entire viewport.Useful for creating an overlay drop zone. Automatically hidden when other visible drop areas are present.
CSS-only attribute for styling single-file upload drop areas.
CSS-only attribute for styling ghost/overlay drop areas.Used internally for overlay drop zones in the upload list.
Clicking/activating opens the initial flow screen instead of file picker.Useful when you want to show the source selection screen.
Drag States
The component provides visual feedback through thedrag-state attribute:
inactive- No drag operationnear- Files are being dragged near the drop areaover- Files are directly over the drop area
Methods
Returns whether the drop area is active and can receive drops.Checks if the drop area is:
- Enabled (not disabled)
- Visible (not hidden)
- Has non-zero dimensions
- Is within the viewport
Custom Content
You can provide custom content using the default slot:Behavior
File Type Filtering
DropArea respects theaccept configuration from the Config component:
Multiple File Restrictions
Respectsmultiple, multipleMax, and multipleMin settings:
Source List Integration
The drop area is only active whenlocal is in the source list:
local from the source list, the drop area becomes disabled.
Supported Drop Types
DropArea supports dropping:- Files from desktop - Standard file drag and drop
- Folders - Recursively processes all files in folders
- URLs - Extracts and uploads files from dropped URLs
Examples
Minimal Drop Area
Full-Featured Drop Area
Fullscreen Overlay
Single File Upload
Image-Only Drop Zone
Programmatic Control
Accessibility
Keyboard Support
Whenclickable is enabled:
Space- Activates the drop areaEnter- Activates the drop area
Screen Readers
The component is focusable and announces its purpose whenclickable is enabled. Consider adding ARIA labels for better accessibility:
Styling
The component can be styled using CSS custom properties and selectors:Source Code Reference
Implementation:/workspace/source/src/blocks/DropArea/DropArea.ts:16
Dropzone functionality: /workspace/source/src/blocks/DropArea/addDropzone.ts
See Also
- Config - Configure upload behavior
- SourceList - Upload source selection
- UploadList - Display uploaded files