Skip to content

useFileDrop ​

useFileDrop(options) accepts files the user drags onto an element. Put attrs on the element, and the files arrive in onFiles as a list.

dragging is true while files are over the element, so you can highlight the zone. Dragged text and links are skipped.

Drop files here

Signature ​

useFileDrop: (options: FileDropOptions) => FileDrop
interface FileDropOptions { readonly disabled?: MaybeRefOrGetter<boolean | undefined>; readonly onFiles: (files: File[]) => void;}
interface FileDrop { readonly dragging: Readonly<Ref<boolean>>; readonly attrs: FileDropAttrs;}

Behaviour ​

disabled: true turns the zone off, and attrs can stay on the element. The Upload zone is built on this composable, and its upload queue on useUploadQueue.

Edit this page

On this page

Search

Esc