YuhuanStudioYunUIDocs
Forms & Inputs

File Dropzone

Drag-and-drop (and click-to-browse) upload target that reports files via onFiles.

A drag-and-drop (and click-to-browse) upload target. It wraps a hidden <input type="file">, adds a drag-over affordance, and hands the chosen files back through onFiles — the host decides what to do with them (upload, attach, preview). Presentation and interaction only; no network. Pass children to fully replace the inner content.

Import

tsx
1import { FileDropzone } from "@yuhuanowo/yunui";

Usage

onFiles receives a File[]. Style the label with icon, label, and hint:

tsx
1<FileDropzone
2 accept="image/*"
3 multiple
4 icon={<UploadCloud />}
5 label="Drop images here, or click to browse"
6 hint="PNG, JPG · up to 10MB"
7 onFiles={(files) => upload(files)}
8/>

Example

Dropzone

Drop images here, or click to browse
PNG, JPG · up to 10MB

Props

PropTypeDefaultDescription
acceptstring`accept` attribute forwarded to the input (e.g. "image/*,.wav").
childrenReactNodeReplace the entire inner content.
classNamestring
disabledbooleanfalseDisable interaction and dim the zone.
hintReactNodeSecondary hint under the label (e.g. "PNG, JPG up to 10MB").
iconReactNodeLeading icon shown above the label (ignored when `children` is set).
labelReactNodeDrop a file here, or click to browsePrimary call-to-action text (ignored when `children` is set).
multiplebooleanfalseAllow selecting more than one file.
onFiles*(files: File[]) => voidCalled with the selected/dropped files (already filtered to a File[]).

On this page