# Dropzone

> A place to drop a file, with a button for when dragging isn't handy: an arrow, what to drop, what's allowed, and Choose a file.

| | |
|---|---|
| Kind | component |
| Contract | `review` · [dropzone.contract.yaml](https://github.com/Runceanu/rost/blob/master/contracts/dropzone.contract.yaml) |
| Guidance | `proposed` |
| Source | [Figma 746:132](https://www.figma.com/design/1Zy0wiWKXQAvsfDBX3KR0d/UI-Kit-v01?node-id=746-132) · read 2026-11-17 · frozen 2026-11-17 |
| Implemented in | nowhere yet |

## Install

It lands in `src/rost/dropzone/`, with what it needs and its contract:

```sh
npx github:Runceanu/rost add dropzone
```

Then import `src/rost/fonts.css` and `src/rost/tokens.css` once, at the root of the app. More on this in [Install](https://rost.build/docs/install.md).

## Props

| Prop | Type | Values | Default |
|---|---|---|---|
| `title` | slot |  |  |
| `help` | slot |  |  |
| `action` | string |  | `Choose a file` |
| `accept` | string |  |  |
| `multiple` | boolean |  | `false` |
| `error` | boolean |  | `false` |
| `over` | boolean |  | `false` |

## Anatomy

- `root`: A column, centred, 12px between its parts and 24px around them, with 12px corners and an edge drawn inside.
- `icon`: Icon's arrow-up, 24px, in the secondary text colour.
- `words`: The title and the help, 2px apart.
- `title`: Paragraph type, medium weight, the main text colour.
- `help` (optional): Label type.
- `input`: The real `<input type="file">`, hidden from sight and from screen readers. The button opens it, so the button is the one control there is.

## When to use

- **Bringing in a document.** A bank statement to import, a receipt to attach. Say in the help which kinds of file work and how big.

## When not to use

- **Dragging as the only way.** Not everyone can drag. The button stays, always.
- **Showing the upload.** What happens after the drop, the progress and the file's name, belongs under it, in a **Progress** or a **ListItem**.

## Behaviour

Dragging a file over it turns its edge green. Dropping or choosing hands the files to `onFiles`. With `error` the edge and the help turn red, and the help says what to fix.

## Accessibility

- **Element**: A `<div>` with a real file input and a real button inside. The drop is a shortcut for the button, never the only way.
- **Name**: The button's words. The help is tied to the button with `aria-describedby`, so it's read with them.
- **Colour**: The idle edge is 4.3:1 on the dark page, the error help 6.9:1.

## Content

The title says what to drop, the help what's allowed: PDF or CSV, up to 10 MB.

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `dropzone/error/edge` | `#f2705f` |
| `dropzone/error/help` | `#f2705f` |
| `dropzone/help` | `#999999` |
| `dropzone/icon` | `#d3d9d5` |
| `dropzone/idle/edge` | `#747573` |
| `dropzone/over/background` | `#171717` |
| `dropzone/over/edge` | `#00d669` |
| `dropzone/title` | `#ededed` |
| `font-family/base` | `'General Sans Variable'` |
| `spacing/gap/3xsmall` | `2px` |
| `spacing/gap/large` | `24px` |
| `spacing/gap/small-medium` | `12px` |
| `spacing/outline/medium` | `2px` |
| `spacing/outline/small` | `1px` |
| `spacing/radius/medium` | `12px` |
| `typography/label/font-size` | `12px` |
| `typography/label/font-weight/regular` | `400` |
| `typography/label/letter-spacing` | `0px` |
| `typography/label/line-height` | `14px` |
| `typography/paragraph/font-size` | `14px` |
| `typography/paragraph/font-weight/medium` | `500` |
| `typography/paragraph/letter-spacing` | `0px` |
| `typography/paragraph/line-height` | `20px` |

## No token, on purpose

| Part | Property | Value | Why |
|---|---|---|---|
| `root` | `outline-offset` | `calc(-1 * var(--spacing-outline-small))` | Composed from a token: the edge sits inside. |
| `root` | `outline-offset` | `calc(-1 * var(--spacing-outline-medium))` | Composed from a token: the edge sits inside. |
| `root` | `outline-offset` | `calc(-1 * var(--spacing-outline-small))` | Composed from a token: the edge sits inside. |

See it live, with every value of every variant: [rost.build/components/dropzone/](https://rost.build/components/dropzone/)
