# File drop zone

Drop, click or paste files into a real file input, so a plain form post sends them. Limits on type, size and count, a list with thumbnails, and French words out of the box.

Section: Components / Inputs
Page: https://ui.heyramzi.com/components/file-drop-zone
Import path: `@heyramzi/ui/components/file-drop-zone`

## Import

```ts
import { FileDropZone } from "@heyramzi/ui/components/file-drop-zone";
```

## Demo

```svelte
<script lang="ts">
	import { FileDropZone } from "@heyramzi/ui/components/file-drop-zone";

	let files = $state<File[]>([]);
</script>

<div class="w-full max-w-md">
	<FileDropZone
		name="justificatifs"
		accept=".pdf,image/*,.csv"
		multiple
		maxFiles={4}
		maxFileSize={10 * 1024 * 1024}
		capturePaste
		bind:files
	/>
</div>
```

## API

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `name` | `string` |  | The file input's name: what the form post carries the files under. |
| `id` | `string` |  | The id of the real input, for an outside `<label for>`. |
| `accept` | `string` |  | Same syntax as the input's `accept`: `.pdf`, `application/pdf`, `image/*`. |
| `multiple` | `boolean` | `false` |  |
| `maxFiles` | `number` |  | Most files the list holds when `multiple` is set. |
| `maxFileSize` | `number` |  | Largest file, in bytes. |
| `required` | `boolean` | `false` |  |
| `disabled` | `boolean` | `false` |  |
| `capturePaste` | `boolean` | `false` | Takes files pasted anywhere on the page. |
| `files` | `File[]` | `[]` | bindable. The chosen files. Kept in step with the real input, so a plain form post sends them. |
| `onUpload` | `(added: File[]) => void` |  | Called with the files a drop, a paste or the picker just added. |
| `onFileRejected` | `(rejected: Rejection[]) => void` |  | Called with each file turned away and why. |
| `labels` | `Partial<Labels>` |  |  |
| `class` | `string` |  |  |
