# 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.

```vue
<template>
  <div class="flex flex-col gap-3 w-full max-w-sm">
    <div
      v-bind="drop.attrs"
      class="border rounded-md p-4 text-center text-sm"
      :class="drop.dragging.value ? 'bg-primary-soft' : 'bg-surface-muted'"
    >
      Drop files here
    </div>
    <ul v-if="names.length > 0" class="m-0 text-sm">
      <li v-for="name in names" :key="name">{{ name }}</li>
    </ul>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useFileDrop } from '@numior/kit';

const names = ref<string[]>([]);

const drop = useFileDrop({
  onFiles: (files) => {
    names.value = files.map((file) => file.name);
  },
});
</script>
```

## Signature

```ts
import { useFileDrop } from '@numior/kit';

useFileDrop: (options: FileDropOptions) => FileDrop
```

```ts
import type { FileDropOptions } from '@numior/kit';

interface FileDropOptions {
  readonly disabled?: MaybeRefOrGetter<boolean | undefined>;
  readonly onFiles: (files: File[]) => void;
}
```

```ts
import type { FileDrop } from '@numior/kit';

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](/en/components/upload) zone is built on this composable, and its upload queue on
[useUploadQueue](/en/composables/upload-queue).
