# Dropzone

> Drop, choose or paste files; checked for type, size and count before they are handed over.

- Tier: free, MIT
- Category: Forms
- Docs: https://ui.mlola.com/docs/components/dropzone

## Install

```bash
npx mlola-ui add dropzone
```

```tsx
import { Dropzone } from "@/components/ui/dropzone";
```

## Example

```tsx
"use client";

import * as React from "react";
import { Dropzone } from "@/components/ui/dropzone";

export default function Example() {
  const [files, setFiles] = React.useState<File[]>([]);
  return (
    <Dropzone
      label="Attachments"
      hint={files.length ? `${files.length} selected` : "PNG or PDF, up to 10 MB"}
      accept="image/png,application/pdf"
      maxSize={10 * 1024 * 1024}
      multiple
      onFiles={setFiles}
    />
  );
}
```

## The same markup without React

```html
<div class="ml-dropzone-root">
  <div class="ml-input-field">
    <label class="ml-input-label" id="dropzone-1-label" for="dropzone-1">Attachments</label>
    <div class="ml-dropzone" id="dropzone-1" role="button" tabindex="0" aria-label="Attachments: drop files here, or press Enter to choose" aria-describedby="dropzone-1-hint">
      <span class="ml-dropzone-icon" aria-hidden="true"><svg class="mlola-glyph" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--mlola-glyph-stroke, var(--ml-icon-stroke, 1.75))" stroke-linecap="round" stroke-linejoin="round" focusable="false" aria-hidden="true" data-optical-size="default" style="color:var(--mlola-glyph-color, currentColor);scale:var(--mlola-glyph-optical-scale, 1);transform-origin:center"><path d="M12 15V3m-5 5 5-5 5 5M5 21h14" pathLength="1"></path></svg></span>
      <span class="ml-dropzone-title">Drop files here, or choose</span>
      <span class="ml-dropzone-rules">PNG, PDF · up to 10.0 MB</span>
      <input type="file" hidden="" accept="image/png,application/pdf" multiple=""/>
    </div>
    <p class="ml-input-hint" id="dropzone-1-hint">PNG or PDF, up to 10 MB</p>
  </div>
</div>
```
