Skip to content
Cojeev UI

Dropzone

Forms

Collects local files through drag and drop or a native file picker and reports the selection.

React · copy into your project · light and dark themes

Try it

Loading preview…

Take it with you

Copy the example, API and usage notes for your editor or AI assistant.

Add to your project

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/dropzone.json

The command includes the component’s shared dependencies. Your project keeps editable source files.

Include the complete example

This example also composes typography. Install its parts together:

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/dropzone.json https://luv-jeri.github.io/cojeev-ui/r/typography.json

Using dropzone

  • Handle onFilesSelected to validate selected File objects and connect your own storage or upload process.

  • Use multiple to limit the selection count and accept to guide the file picker; validate dropped files in the callback.

API

Compose the exported parts below. The prop types are read from the React source during the registry build.

Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.

DropzoneProps

PropTypeRequired
variant"default" | "compact" | null | undefinedNo
onFilesSelected(files: File[]) => voidNo
onFilesRejected(files: DropzoneRejection[]) => voidNo
acceptstringNo
maxSize

Maximum bytes per file. Omit to leave file size unrestricted.

numberNo
multiplebooleanNo
disabledbooleanNo
showReceiptbooleanNo

Accessibility

  • The surface supports Enter and Space to open the picker; give it a task-specific accessible name.

  • Keep the selection receipt or provide equivalent status feedback that names the selected files.

States and appearance

emptydraggingselectedinvaliddisabled

For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.

Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.