--- category: Elements --- # useDropZone Create a zone where files can be dropped. ::: warning Due to Safari browser limitations, file type validation is only possible during the drop event, not during drag events. As a result, the `isOverDropZone` value will always be `true` during drag operations in Safari, regardless of file type. ::: ## Usage ```vue ``` ## Type Declarations ```ts export interface UseDropZoneReturn { files: ShallowRef; isOverDropZone: ShallowRef; } export interface UseDropZoneOptions { /** * Allowed data types, if not set, all data types are allowed. * Also can be a function to check the data types. */ dataTypes?: MaybeRef | ((types: readonly string[]) => boolean); /** * Similar to dataTypes, but exposes the DataTransferItemList for custom validation. * If provided, this function takes precedence over dataTypes. */ checkValidity?: (items: DataTransferItemList) => boolean; onDrop?: (files: File[] | null, event: DragEvent) => void; onEnter?: (files: File[] | null, event: DragEvent) => void; onLeave?: (files: File[] | null, event: DragEvent) => void; onOver?: (files: File[] | null, event: DragEvent) => void; /** * Allow multiple files to be dropped. Defaults to true. */ multiple?: boolean; /** * Prevent default behavior for unhandled events. Defaults to false. */ preventDefaultForUnhandled?: boolean; } export declare function useDropZone( target: MaybeRefOrGetter, options?: UseDropZoneOptions | UseDropZoneOptions['onDrop'], ): UseDropZoneReturn; ```