Dropzone
FormsCollects local files through drag and drop or a native file picker and reports the selection.
Try it
Add to your project
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/dropzone.jsonThe 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:
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/dropzone.json https://luv-jeri.github.io/cojeev-ui/r/typography.jsonUsing 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
| Prop | Type | Required |
|---|---|---|
variant | "default" | "compact" | null | undefined | No |
onFilesSelected | (files: File[]) => void | No |
onFilesRejected | (files: DropzoneRejection[]) => void | No |
accept | string | No |
maxSizeMaximum bytes per file. Omit to leave file size unrestricted. | number | No |
multiple | boolean | No |
disabled | boolean | No |
showReceipt | boolean | No |
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
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.