Skip to content

Dropzone

Free

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.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 16, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

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

attachments.tsx

Dropzone

<div>
PropTypeDefaultDescription
acceptAccept | AcceptGroup[]—
minSizenumber—
maxSizenumber—
maxFilesnumber0
preventDropOnDocumentboolean—
noKeyboardbooleantrue
noDragboolean—
noDragEventsBubblingboolean—
noPasteboolean—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
disabledbooleanfalse
onDrop—
onDropAccepted—
onDropRejected—
getFilesFromEvent—
onFileDialogCancel—
onFileDialogOpen—
onError—
validator—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—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.
useFsAccessApiboolean—
autoFocusbooleanfalse
labelsPartial<DropzoneLabels>—The words the Dropzone writes itself: state titles, the rules line, sources (DROPZONE_LABELS).
filesreadonly File[]—The accepted files (controlled).
defaultFilesreadonly File[]—The accepted files at first (uncontrolled).
onFilesChange—Runs when a drop, a pick, a paste, or a remove changes the list.
namestring—The form field name: a normal form submit sends the files under it.
requiredbooleanfalseThe form needs at least one file (native validation on submit).
readOnlybooleanfalseThe 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.
invalidbooleanfalseShows the area as invalid (a red edge), for an error that the app sets.
noClickbooleanfalseA click on the area does not open the dialog; only the trigger does. Default false.
localeLocalesArgument—The locale of the sizes in the messages and the file list.
directorybooleanfalseThe 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—Gets open (the file dialog, for a menu item or a shortcut, in the press itself), clear (empties the list), and clearRejections.
classNamestring—
childrenReactNode—
...props<div> attributes—Every other attribute goes to the <div>.

DropzoneArea

<div>
PropTypeDefaultDescription
variant"bare""default""fullscreen""inline""default"
children—The parts, or a function of the drag state that returns them (to change the words).
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DropzoneMedia

<div>
PropTypeDefaultDescription
size"default""sm""xs"—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DropzoneContent

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DropzoneTitle

<p>
PropTypeDefaultDescription
...props<p> attributes—Every other attribute goes to the <p>, with a ref.

DropzoneDescription

<p>
PropTypeDefaultDescription
...props<p> attributes—Every other attribute goes to the <p>, with a ref.

DropzoneTrigger

<button>
PropTypeDefaultDescription
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"
classNamestring—
busyboolean—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.
focusOnMountboolean—Takes the focus when it mounts. Default: the autoFocus of the root.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

DropzoneOverlay

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DropzoneRejections

<div>
PropTypeDefaultDescription
children—One line for one message. Default: the message, then the file names.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DropzoneIdle

PropTypeDefaultDescription
childrenReactNode—

DropzoneAccept

PropTypeDefaultDescription
childrenReactNode—

DropzoneReject

PropTypeDefaultDescription
childrenReactNode—

DropzoneRules

<p>
PropTypeDefaultDescription
...props<p> attributes—Every other attribute goes to the <p>, with a ref.

DropzoneCount

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

DropzonePasteHint

<p>
PropTypeDefaultDescription
...props<p> attributes—Every other attribute goes to the <p>, with a ref.

DropzoneSources

<div>
PropTypeDefaultDescription
orientation"horizontal""vertical""horizontal"A row of ghost buttons under the trigger (default), or a column (a side list in a dialog).
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DropzoneSource

<button>
PropTypeDefaultDescription
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"—
classNamestring—
busyboolean—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.
kindRequired"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).
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

DropzoneIllustration

<div>
PropTypeDefaultDescription
kinds—The three kinds of the fan, start to end. Default: from accept, else PDF, image, sheet.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • 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.
  • To crop a picture after people pick it, add an Image Cropper.
  • To show one task with no file list, use a Progress.
EnterorSpaceOn DropzoneTrigger: opens the file dialog.
⌘VorCtrlVFocus on a part inside the area: pastes files.
EnterorSpaceOn the area, with noKeyboard={false}: opens the file dialog.

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.

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

Built with

Installs with Dropzone

  1. AddedDropzone, with Button, File Icon, Input, Kbd, Popover, Spinner.
Open the release