# isDragGlobal Example The `isDragGlobal` state is `true` when files are being dragged anywhere on the document, before they reach the dropzone. This allows you to show visual feedback (like a full-page overlay) to indicate where files can be dropped. ## Simple Example ```jsx harmony import React from 'react'; import {useDropzone} from 'react-dropzone'; function DragOverlay() { const { getRootProps, getInputProps, isDragGlobal, isDragActive, isDragAccept, isDragReject, acceptedFiles } = useDropzone({ accept: { 'image/*': ['.png', '.jpg', '.jpeg', '.gif'] } }); const files = acceptedFiles.map(file => (
  • {file.path} - {file.size} bytes
  • )); return (
    {/* Global overlay shown when dragging anywhere on the page */} {isDragGlobal && !isDragActive && (

    Drop files anywhere on this page...

    )}
    {/* Status indicators */} {isDragGlobal && !isDragActive && (

    🌐 Drag detected on page!

    )} {isDragActive && !isDragAccept && !isDragReject && (

    Drop files here...

    )} {isDragAccept && (

    ✅ Drop to upload these files

    )} {isDragReject && (

    ❌ Some files will be rejected

    )} {!isDragGlobal && !isDragActive && (

    Drag 'n' drop images here, or click to select files

    )}
    ); } ``` ## State Transitions The `isDragGlobal` state provides early feedback about drag operations: 1. **`isDragGlobal: false`** - No drag operation detected 2. **`isDragGlobal: true`** - Files are being dragged anywhere on the document - This is set when `dragenter` fires on the document with files 3. **`isDragActive: true`** - Files are being dragged over the dropzone - Takes precedence when you want to show different feedback 4. **`isDragAccept: true`** / **`isDragReject: true`** - Files are validated - Indicates whether the dragged files meet the dropzone criteria ## Use Cases - **Full-page overlays**: Show a visual indicator across the entire page when drag starts - **Multi-dropzone highlighting**: Highlight all available dropzones when files are detected - **Early user feedback**: Provide immediate visual feedback before users reach the target dropzone - **Improved UX**: Make it clear that the application accepts drag and drop ## Events `isDragGlobal` is reset to `false` when: - Drag leaves the document (`dragleave` on all elements) - Files are dropped anywhere (`drop` event) - Drag operation is cancelled (`dragend` event, e.g., user presses ESC)