---
title: "Dropzone"
description: "An area where people drop, paste, or pick files. It shows the file rules, says why a drag is refused, and can add more sources."
url: https://gelatinui.com/components/dropzone
markdown_url: https://gelatinui.com/components/dropzone.md
access: free
install: "npx shadcn@latest add @gelatin-ui/dropzone"
registry_item: https://gelatinui.com/r/dropzone.json
version: "2026-11-16"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Dropzone

> An area where people drop, paste, or pick files. It shows the file rules, says why a drag is refused, and can add more sources.

Page: https://gelatinui.com/components/dropzone

## When to use it

Best for: Adding files by drop, paste, or the file dialog, with a clear answer before the drop.

- Use it when people add files by drop, paste, the file dialog, a folder, the camera, or a link.
- Put `Attachments` with `layout` `row` or `tile` in the Dropzone to show what they added.
- Use `variant="fullscreen"` on the area to take a drop anywhere on the page.
- Use `variant="bare"` with `DropzoneOverlay` to make an existing box a drop target.
- Use `DropzoneRules` with no children, so the rules line comes from `accept`, the sizes, and `maxFiles`.

## When not to use it

- To crop a picture after people pick it, add an [Image Cropper](https://gelatinui.com/components/image-cropper.md).
- To show one task with no file list, use a [Progress](https://gelatinui.com/components/progress.md).

## Notes for agents

- The component never uploads. Pass `useFileUploads` `files` and `sync` as `files` and `onFilesChange`, and `uploads` to `Attachments`.
- The area is not a tab stop by default. Include a `DropzoneTrigger`, or pass `noKeyboard={false}`.
- Use one `DropzoneArea` per `Dropzone`. The area holds the hidden file input.
- Add `DropzoneRejections`, or the reasons for a rejected file do not show. It also shows `onError`.
- `DropzoneTitle` and `DropzoneRules` write their own words in the drag, full, and replace states. Change them with `labels`.
- A `validator` runs only on drop. A drag gives no file names or sizes.
- `DropzoneSource` `link` needs `onLink`: fetch the file in your app and return it.
- `disabled` stops only the files. Other controls inside the area stay on.

## Anatomy

```text
Dropzone
├─ DropzoneArea (0..n)
├─ DropzoneMedia (0..n)
├─ DropzoneContent (0..n)
├─ DropzoneTitle (0..n)
├─ DropzoneDescription (0..n)
├─ DropzoneTrigger (0..n)
├─ DropzoneOverlay (0..n)
├─ DropzoneRejections (0..n)
├─ DropzoneRules (0..n)
├─ DropzoneCount (0..n)
├─ DropzonePasteHint (0..n)
├─ DropzoneSources (0..n)
├─ DropzoneSource (0..n)
└─ DropzoneIllustration (0..n)
```

## API reference

### Dropzone

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `accept` | `Accept \| AcceptGroup[]` |  |  |
| `minSize` | `number` |  |  |
| `maxSize` | `number` |  |  |
| `maxFiles` | `number` | 0 |  |
| `preventDropOnDocument` | `boolean` |  |  |
| `noKeyboard` | `boolean` | true |  |
| `noDrag` | `boolean` |  |  |
| `noDragEventsBubbling` | `boolean` |  |  |
| `noPaste` | `boolean` |  | If true, disables paste-to-upload. By default, when the dropzone (or a focused child) receives a paste that carries files - e.g. a screenshot pasted with Ctrl/Cmd+V - those files go through the same `accept`/size/`validator` checks and `onDrop` callbacks as a drop. Pastes with no files (plain text, etc.) are ignored and left untouched. See https://github.com/react-dropzone/react-dropzone/issues/1210 |
| `disabled` | `boolean` | false |  |
| `onDrop` | `function` |  |  |
| `onDropAccepted` | `function` |  |  |
| `onDropRejected` | `function` |  |  |
| `getFilesFromEvent` | `function` |  |  |
| `onFileDialogCancel` | `function` |  |  |
| `onFileDialogOpen` | `function` |  |  |
| `onError` | `function` |  |  |
| `validator` | `function` |  | Custom validation, run once per file on drop/selection. Return `null` to accept the file, or a FileError (or array of them) to reject it. May be `async` (return a `Promise`) to support checks that can't run synchronously - e.g. reading image dimensions, inspecting file contents, or calling an external service. While an async validator is pending, DropzoneState.isProcessing is `true`, and `onDrop`/`onDropAccepted`/`onDropRejected` fire only once it settles. If the validator throws or rejects, `onError` is called and the drop is discarded. Note: the validator never runs during a drag (a `DataTransferItem` has no name/size), so a validator-configured dropzone is `isDragUnknown` until drop. |
| `getErrorMessage` | `function` |  | Override the message of any rejection error (built-in or custom). Called once per error; receives the error and the file it belongs to and returns the message to use. Return `error.message` for codes you don't want to change. Useful for localizing error messages. |
| `useFsAccessApi` | `boolean` |  |  |
| `autoFocus` | `boolean` | false |  |
| `labels` | `Partial<DropzoneLabels>` |  | The words the Dropzone writes itself: state titles, the rules line, sources (`DROPZONE_LABELS`). |
| `files` | `readonly File[]` |  | The accepted files (controlled). |
| `defaultFiles` | `readonly File[]` |  | The accepted files at first (uncontrolled). |
| `onFilesChange` | `function` |  | Runs when a drop, a pick, a paste, or a remove changes the list. |
| `name` | `string` |  | The form field name: a normal form submit sends the files under it. |
| `required` | `boolean` | false | The form needs at least one file (native validation on submit). |
| `readOnly` | `boolean` | false | The list shows, but nothing adds files: no dialog (also not from a label click), no drop, and no paste; the trigger is off. Render no remove buttons then. Default `false`. |
| `invalid` | `boolean` | false | Shows the area as invalid (a red edge), for an error that the app sets. |
| `noClick` | `boolean` | false | A click on the area does not open the dialog; only the trigger does. Default `false`. |
| `locale` | `LocalesArgument` |  | The locale of the sizes in the messages and the file list. |
| `directory` | `boolean` | false | The dialog picks a folder (`webkitdirectory`), and every file in it is added. A dropped folder always works. Not with `useFsAccessApi`: that picker cannot choose folders. |
| `capture` | `"environment" \| "user" \| boolean` |  | The camera on a phone (`capture` of the file input): `"environment"` (back) or `"user"` (front). Android opens only the camera then. For a choice of camera or gallery, use two Dropzones, each with its own trigger. |
| `actionsRef` | `RefObject` |  | Gets `open` (the file dialog, for a menu item or a shortcut, in the press itself), `clear` (empties the list), and `clearRejections`. |
| `className` | `string` |  |  |
| `children` | `ReactNode` |  |  |

### DropzoneArea

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `"bare" \| "default" \| "fullscreen" \| "inline"` | "default" |  |
| `children` | `function \| ReactNode` |  | The parts, or a function of the drag state that returns them (to change the words). |

### DropzoneMedia

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `size` | `"default" \| "sm" \| "xs"` |  |  |

### DropzoneContent

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### DropzoneTitle

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### DropzoneDescription

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### DropzoneTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` | "sm" |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` | "outline" |  |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `focusOnMount` | `boolean` |  | Takes the focus when it mounts. Default: the `autoFocus` of the root. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### DropzoneOverlay

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### DropzoneRejections

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `function` |  | One line for one message. Default: the message, then the file names. |

### DropzoneIdle

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  |  |

### DropzoneAccept

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  |  |

### DropzoneReject

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  |  |

### DropzoneRules

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### DropzoneCount

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### DropzonePasteHint

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### DropzoneSources

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `orientation` | `"horizontal" \| "vertical"` | "horizontal" | A row of ghost buttons under the trigger (default), or a column (a side list in a dialog). |

### DropzoneSource

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `kind` | `"camera" \| "device" \| "folder" \| "link"` |  | - `device`: the file dialog. - `folder`: a folder dialog (`webkitdirectory`); every file in it is added with its path. - `camera`: the camera on a phone (`capture`); a desktop opens the file dialog. - `link`: a popover with a link field; `onLink` gets the link and returns the file. |
| `facing` | `"environment" \| "user"` |  | The camera of `camera`: `"environment"` (back, default) or `"user"` (front). |
| `onLink` | `function` |  | For `link`: get the file of a link (fetch it in your app, with your own checks of the host). The files go through the same checks as a drop. Throw an `Error` to show its message. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### DropzoneIllustration

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `kinds` | `readonly [FileKind, FileKind, FileKind]` |  | The three kinds of the fan, start to end. Default: from `accept`, else PDF, image, sheet. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Dropzone | `dropzone` |  |  |  |
| DropzoneArea | `dropzone-area` | `aria-invalid`, `data-clickable`, `data-dialog-open`, `data-disabled`, `data-drag-active`, `data-drag-global`, `data-drag-reject`, `data-readonly` |  | `motion-timing` |
| DropzoneMedia | `dropzone-media` | `data-drag-active`, `data-drag-reject` |  | `status-colors` |
| DropzoneContent | `dropzone-content` | `data-variant` |  |  |
| DropzoneTitle | `dropzone-title` | `data-phase`, `data-variant` |  | `status-colors` |
| DropzoneDescription | `dropzone-description` |  |  |  |
| DropzoneTrigger | `dropzone-trigger` | `data-variant` |  |  |
| DropzoneOverlay | `dropzone-overlay` | `data-drag-active`, `data-drag-reject` |  | `motion-timing` |
| DropzoneRejections | `dropzone-rejections` |  |  |  |
| DropzoneRules | `dropzone-rules` | `data-phase` |  | `status-colors` |
| DropzoneCount | `dropzone-count` |  |  |  |
| DropzonePasteHint | `dropzone-paste-hint` |  |  | `motion-timing` |
| DropzoneSources | `dropzone-sources` | `data-variant` |  |  |
| DropzoneSource | `dropzone-source` |  |  |  |
| DropzoneIllustration | `dropzone-illustration` | `data-drag-active` |  | `motion-timing` |

## Usage

Put a `DropzoneArea` inside `Dropzone`. The rules line comes from the checks. The component never uploads: your app sends each file.

```tsx title="attachments.tsx"
import {
  Dropzone,
  DropzoneArea,
  DropzoneContent,
  DropzoneMedia,
  DropzoneRejections,
  DropzoneRules,
  DropzoneTitle,
  DropzoneTrigger,
} from "@/components/ui/dropzone";

export function Attachments() {
  return (
    <Dropzone accept={{ "image/*": [".png", ".jpg"] }} maxSize={10_000_000} maxFiles={5}>
      <DropzoneArea>
        <DropzoneMedia />
        <DropzoneContent>
          <DropzoneTitle>Drop photos here or browse</DropzoneTitle>
          <DropzoneRules />
        </DropzoneContent>
        <DropzoneTrigger />
      </DropzoneArea>
      <DropzoneRejections />
    </Dropzone>
  );
}
```

## Compose

Build it with:

- [Attachment](https://gelatinui.com/components/attachment.md): Shows each file with its state.
- [Progress](https://gelatinui.com/components/progress.md): Shows how far an upload is.
- [Files Illustration 01](https://gelatinui.com/components/files-illustration-01.md): Fills the empty drop area.

Rules:

- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.
- No layout jump (`no-layout-jump`): When a state change adds, removes, or resizes content, reserve its space or animate its size, so nothing below it jumps.
- Real content (`real-content`): Fill the UI with content of the real product (real names, amounts, dates, and states), never lorem text or "Item 1".
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.

Patterns: `gelatin://patterns/file-upload`

## Add it

```bash
npx shadcn@latest add @gelatin-ui/dropzone
```

It adds 58 registry items: 55 files, 10105 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@phosphor-icons/react`, `clsx`, `react-dropzone`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [File Icon](https://gelatinui.com/components/file-icon.md)
- [Input](https://gelatinui.com/components/input.md)
- [Kbd](https://gelatinui.com/components/kbd.md)
- [Popover](https://gelatinui.com/components/popover.md)
- [Spinner](https://gelatinui.com/components/spinner.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Field](https://gelatinui.com/components/field.md)
- [Progress](https://gelatinui.com/components/progress.md)
- [Image Cropper](https://gelatinui.com/components/image-cropper.md)
- [File Input](https://gelatinui.com/components/file-input.md)
- [File Trigger](https://gelatinui.com/components/file-trigger.md)
- [Attachment](https://gelatinui.com/components/attachment.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Enter, Space | On `DropzoneTrigger`: opens the file dialog. |
| ⌘V, Ctrl+V | Focus on a part inside the area: pastes files. |
| Enter, Space | On the area, with `noKeyboard={false}`: opens the file dialog. |

## Accessibility

The area is not a tab stop by default. `DropzoneTrigger` is the button for the keyboard, or pass `noKeyboard={false}` to focus the area.

`DropzoneRules` describes the area and the trigger, so the rules are read with the button.

`DropzoneRejections` shows the reason for each rejected file in text.

On a coarse pointer the words say to tap and not to drag. The paste hint does not show there.

## Motion

| Part | Motion |
| --- | --- |
| Drag over | fade · 150ms · ease-out (0, 0, 0.2, 1) · the full-screen area fades in |
| Drag leave | fade-exit · 90ms · ease-out (0, 0, 0.2, 1) |
| Empty fan | panel · 260ms · ease-panel (0.2, 0.4, 0.2, 1) · the side File Icons of `DropzoneIllustration` turn to 16° and the middle one rises 4px while files are over the area |
| Overlay | fade · 150ms · ease-out (0, 0, 0.2, 1) · `DropzoneOverlay` fades in over a `bare` area during a drag |
| Paste hint | fade · 150ms · ease-out (0, 0, 0.2, 1) · `DropzonePasteHint` fades in while the focus is in the area |
