# UploadDropzone: drop or pick a file

UploadDropzone is the file input of every form and record in an app built on Meadowstack: one box that takes a dropped file or opens the picker. It answers while a file is dragged over it, refuses a file that is too big on the spot, and shows the upload inside itself until it lands.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/components/upload-dropzone/

*Kestrel's client portal in the demo, where a client sends the receipt the office is missing: no file yet, on its way at 35%, uploaded. The file's name and size are an example.*

A live screen, rendered from the kit's components on the page: https://meadowstack.com/components/upload-dropzone/

## What it is for

Wherever a form or a record takes a file, an app built on Meadowstack shows the same box: a title that says what to send, a hint with the types and the limit, and room to drop the file or click for the picker. The whole box is one button, so it is a large target on a phone, where the hint in the demo says "A phone photo or a PDF".

The preview follows one upload on the client portal of the [Kestrel example](https://meadowstack.com/examples/accounting-office-documents/), where a client sends the receipt the office is missing. Before a file, the box waits. While the request runs, it shows the file's name and size, a percentage that rolls and a bar under them. When the request returns, the word uploaded lands with a check. In the running app the box also answers while a file is dragged over it, and refuses a file over the limit before anything is sent.

The manifest says when: every file input in a form or on a record. Files dropped anywhere on a whole conversation, like a chat, are `FileDropzone`'s job.

## The rules and where they live

- **File inputs are UploadDropzone.** The root `AGENTS.md`, Lightness, in the list of things that always come from the kit.
- **A drop box that answers before the file is let go, refuses a file that is too big on the spot and shows the upload in itself.** `docs/patterns.md`, Files and photos, where the Stonebridge budget import is the place to try it.
- **No own input in an app.** The static guard `bare-control` in `scripts/check-markup.mjs` fails an app's own `input`, which includes `type="file"` (`docs/audit.md`).
- **Every input has a name people and screen readers get.** `AGENTS.md`, Accessibility: the title is visible, and `inputLabel` names the file input itself ("Document file").
- **Numbers roll, landings pop.** `AGENTS.md`, Motion: the percentage is the kit's `AnimatedNumber`, the check lands on the kit's curve, and reduced motion keeps fades only.
- **External roles see only their own records.** `AGENTS.md`, Permissions and audit: the portal lists and takes only the client's own documents, which is why the box names the one that is missing.

## What AI coding tools write instead

The manifest names **a bare `<input type=file>`** and **a hand-built drop area**. The bare input looks different in every browser, has no room for a hint, and says nothing about the upload once a file is chosen. The hand-built drop area usually works only with a mouse, checks the size after the whole file has gone to the server, shows a spinner with no progress, and forgets the file's name the moment it lands, so nobody can tell which receipt went.

`UploadDropzone` keeps one shape for all of it: `accept` and `maxSize` are checked in the browser before the upload starts, the file's state comes back in through `file`, and the box is a real button that Tab reaches and Enter opens.

## How to use it

| Prop | What it takes |
| --- | --- |
| `onFiles` | Gets the picked or dropped files; your code uploads them. |
| `accept`, `maxSize`, `multiple` | Allowed types, the limit in bytes, more than one file. |
| `title`, `hint` | What to send, and the types and limit in words. |
| `file` | The upload's state: `name`, `size`, `progress` from 0 to 1, `done`; `null` for none. |
| `inputLabel` | The file input's accessible name. |
| `disabled`, `className` | While the form cannot take a file; your layout. |

The api does the upload and checks the person's permissions; set `file` while it runs and when it returns, as the demo's portal does.

## Its entry in the manifest

*The component's rules as the kit's manifest states them, the same entry an AI coding tool reads.*

| Manifest field | UploadDropzone |
| --- | --- |
| What it is | Drop or pick files, with progress per file. |
| Use it for | Every file input in a form or on a record. |
| Not for | For files dropped on a whole conversation (FileDropzone) |
| It replaces | A bare <input type=file>; A hand-built drop area |
| Screen types | Form; Record; Settings |
| Import | `import { UploadDropzone } from "@meadowstack-studio/kit";` |

Read from the kit's component manifest when the site was built (126 components, packages/kit/src/components.json); the same entry answers an AI coding tool through the kit's MCP server.

## Where the example apps use it

*The example apps and modules that render UploadDropzone, read from the demo's code when the site builds.*

| Example app | Modules that render it |
| --- | --- |
| [An app for a haulage company](https://meadowstack.com/examples/haulage-dispatch-planning/) | Costs |
| [An app for a construction company](https://meadowstack.com/examples/construction-site-management/) | Drawings, Budget |
| [An app for an accounting office](https://meadowstack.com/examples/accounting-office-documents/) | Documents |

Read from the demo's source when the site was built: 3 of 9 example apps render <UploadDropzone>, in the modules named here as each app's sidebar names them.

## How the demo calls it

*The client portal's box: images and PDFs up to the portal's limit, a title that names whose document is missing, and the upload's state passed back in as file.*

From `apps/demo/src/modules/documents/components/client-portal.tsx` in the Meadowstack repository:

```tsx
<UploadDropzone
  onFiles={(files) => void upload(files)}
  accept="image/*,.pdf"
  maxSize={MAX_SIZE}
  file={file}
  title={tx(`Nahrajte doklad: ${line.counterparty}`, `Upload the document: ${line.counterparty}`)}
  hint={tx("Fotka z telefonu nebo PDF, do 20 MB", "A phone photo or a PDF, up to 20 MB")}
  inputLabel={tx("Soubor dokladu", "Document file")}
/>
```

## How the demo moves the upload along

*The portal sets the file to 35% while the request runs and to done when it returns; the box draws both.*

From `apps/demo/src/modules/documents/components/client-portal.tsx` in the Meadowstack repository:

```tsx
const upload = async (files: File[]) => {
  const picked = files[0];
  if (!picked || !line) return;
  setFile({ name: picked.name, size: picked.size, progress: 0.35 });
  try {
    await uploadDocument(company.slug, line.id, picked.name, person);
    setFile({ name: picked.name, size: picked.size, progress: 1, done: true });
```

## Questions

### What happens when a file is too big?

The box refuses it on the spot, before anything is sent. The limit is the maxSize you pass, 20 MB on the demo's client portal, and the hint under the title says it in words.

### Can people use it without a mouse?

Yes. The whole box is one button: Tab reaches it, Enter or Space opens the file picker, and dropping a file is only the faster way.

### How is it different from FileDropzone?

UploadDropzone is a box in a form or on a record. FileDropzone takes files dropped anywhere on a whole conversation, like a chat.

### Does the component upload the file itself?

No. It hands the files to your code and draws the state you pass back, so the app's api does the upload and checks who may send what.

## Related

- [A change order that shows its price before anyone approves it](https://meadowstack.com/screens/change-order-form/) (Screens)
- [A driver record that says what expires next](https://meadowstack.com/screens/driver-record/) (Screens)
- [A lot record that traces one step back and one step forward](https://meadowstack.com/screens/lot-traceability/) (Screens)
- [A packaging quote that works out its price as you type](https://meadowstack.com/screens/quote-form/) (Screens)
- [A site diary day, prefilled and signed by the right person](https://meadowstack.com/screens/site-diary/) (Screens)
- [An invoice form that shows its totals as you type](https://meadowstack.com/screens/invoice-form/) (Screens)
