Drop Zone Membrane

View registry JSON

A responsive membrane drop zone with shadcn attachments, upload progress, processing, retry and cancellation.

Install with the shadcn CLI

npx shadcn@4.21.5 add @cavemio/drop-zone-membrane
First install? Configure @cavemio once

Run npx shadcn@4.21.5 init if shadcn is not set up, then merge this entry into the registries field in your existing components.json. Keep your other settings and registries.

components.json
{
  "registries": {
    "@cavemio": "https://registry.cavemio.dev/r/cavemio-{name}.json"
  }
}

Overview

A responsive membrane drop zone with shadcn attachments, upload progress, processing, retry and cancellation.

The preview simulates upload progress locally; supply onUpload for a real service. Without it, selected files remain ready to upload.

import { DropZoneMembrane } from "@/components/drop-zone-membrane";

<DropZoneMembrane accept="image/*,.pdf" maxSize={10_000_000} maxFiles={2} onFilesChange={setFiles} onUpload={uploadFile} />

Props

PropTypeDescription
onUploadDropZoneMembraneUploadOptional. Uploads one file: report progress, honour the signal, resolve when done or throw to show an error with Retry.
autoUploadbooleanOptional. Start uploads on selection. False exposes an Upload action on each ready file.
onFilesChange(files: File[]) => voidOptional. The files currently in the list, after every add and remove.
acceptstringOptional. Like an input's accept: MIME types, wildcards and extensions, e.g. "image/*,.pdf".
maxSizenumberOptional. Largest file in bytes.
maxFilesnumberOptional. Maximum number of files accepted in the list.
multiplebooleanOptional. One file at a time: a new drop replaces it.
titlestringOptional. The resting label.
hintstringOptional. File requirements in the tray footer, e.g. "PNG, JPG or PDF, up to 10 MB".
disabledbooleanOptional. Disable user interaction.
refReact.Ref<DropZoneMembraneHandle>Optional. Ref exposing the file-picker controls.