Events
Drag me
Drop here
Labeling
Drop files here
FileTrigger
Drop files here
Visual Feedback
Default
Hover
Drop Target
Success
Drop PNG files here
Props
Name | Type | Default | Description |
---|---|---|---|
onDrop | (e: DropEvent) => void | - | Handler that is called when a valid drop occurs. |
onDropEnter | (e: DropEvent) => void | - | Handler that is called when a drag enters the drop target. |
onDropExit | (e: DropEvent) => void | - | Handler that is called when a drag exits the drop target. |
getDropOperation | (types: Set<string>) => DropOperation | - | Function that returns the drop operation to be performed. |
isDisabled | boolean | false | Whether the drop zone is disabled. |
Styling
React Aria components can be styled in many ways, including using CSS classes, inline styles, utility classes (e.g. Tailwind), CSS-in-JS (e.g. Styled Components), etc.
.react-aria-DropZone { /* Base styles */}.react-aria-DropZone[data-drop-target] { /* Drop target styles */}.react-aria-DropZone[data-focus-visible] { /* Focus styles */}
Keyboard Shortcuts
The following keyboard shortcuts are available:
- Space or Enter - Opens file dialog when FileTrigger is present
- Ctrl+V / Cmd+V - Paste files from clipboard
- Tab - Navigate to/from the drop zone
Feedback
Help us improve this component by providing feedback, asking questions on GitHub, or updating this file.