Skip to content
Redpanda UI
Esc
↑↓navigate↵open⌘Jpreview
Made by haydenbleasel
Edit on GitHub

Dropzone

Allows users to drag-and-drop files into a container to upload or process them.

Installation

bash
npx shadcn@latest add @redpanda/dropzone
bash
pnpm dlx shadcn@latest add @redpanda/dropzone
bash
yarn dlx shadcn@latest add @redpanda/dropzone
bash
bunx shadcn@latest add @redpanda/dropzone
bash
nubx shadcn@latest add @redpanda/dropzone
bash
aube dlx shadcn@latest add @redpanda/dropzone

When to use

Use this decision tree to determine when to use the Dropzone component:

Features

  • Drag and drop files to upload
  • Customize the empty state and content
  • Intelligently handle file types, sizes, and counts
  • Show file names and sizes in a human readable format
  • Handle errors and reject files
  • Disable the dropzone when needed
  • Customize the appearance with className
  • Show file previews for images
  • Replace existing files by dragging new ones
  • Context provider for accessing dropzone state

Examples

With min and max sizes

Multiple files

Images only

With custom empty state

Showing an image preview

Avatar upload

Per-file upload progress

Table

This example simulates uploads locally; files stay in the browser. The table displays file icons, progress and every failure message. Retry restarts only that file, removing the selected file clears its picker summary, and Download saves the original local file contents. The table uses the standard cell grid and owned destructive retry recipe rather than custom cell padding or button colors.

Props

Credits

  • We use Kibo UI for the dropdown menu component and style.

Error ownership and action layout

Dropzone displays all validation failures with filenames and associates the error with its native action. onError is optional; use it for notifications or telemetry, not a duplicate validation alert. Rejection notifications use an AggregateError with every file reason. A later accepted selection clears the built-in message. Synchronous onDrop failures and picker/validator errors are visible too.

Use appearance="avatar" for the circular avatar picker. Other upload actions use the default recipe. className controls the outer layout; the ref still targets the native button. The native file input remains hidden beside the button. Custom content inside the action must be phrasing-only and contain no independent controls; put separate actions outside Dropzone.

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
See full history →

Last updated on

Was this page helpful?