Dropzone
Loading example…
Dropzone is part of the Forms set, imported from @jcsoftdev/ui/forms.
Import
Section titled “Import”import { Dropzone } from "@jcsoftdev/ui/forms";Single-component entry points tree-shake to just this component: @jcsoftdev/ui/forms/dropzone.
<Dropzone title="Arrastra la foto del corte" hint="PNG o JPG, máximo 2 MB" browseLabel="Elegir archivo" acceptedTypes={["image/*"]} maxSizeBytes={2 * 1024 * 1024} multiple/>| Prop | Type | Default | Description |
|---|---|---|---|
onFiles * |
(files: File[]) => void |
||
onReject |
((rejections: DropzoneRejection[]) => void) |
Called with the rejected files; the caller composes the user-facing message. | |
acceptedTypes |
string[] |
Accepted MIME types; supports wildcards such as image/*. |
|
maxSizeBytes |
number |
||
multiple |
boolean |
true |
|
title * |
string |
||
hint |
string |
||
browseLabel * |
string |
||
mode |
"zone" | "field" |
"zone" |
zone (default): a drop target with a browse button. field: a form control. The real <input type="file"> is the focusable, labelled element (Tab to it, Enter or Space opens the picker, a Field label points at it), clicking anywhere in the box opens the… |
accept |
string |
Accepted file types as the native accept attribute: MIME types, wildcards and extensions (“.pdf,image/*”). Validated like acceptedTypes; both can be given. |
|
id |
string |
Field mode: id of the file input (Field sets it). |
|
name |
string |
Field mode: name the selected files are submitted under. | |
onChange |
ChangeEventHandler<HTMLInputElement> |
Field mode: native change event of the input, after rejected files were dropped from it. | |
showFiles |
boolean |
Field mode: lists the selected files, each with a remove button. | |
disabled |
boolean |
||
required |
boolean |
||
invalid |
boolean |
||
aria-label |
string |
||
aria-labelledby |
string |
||
aria-describedby |
string |
||
aria-invalid |
boolean |
||
className |
string |
||
classNames |
Partial<Record<DropzonePart, string>> |
Per-part classes merged with cn; consumer classes win. className still targets the root and is merged last. |
|
intent |
string |
||
intentKey |
string |
* marks a required prop.
Storybook stories
Section titled “Storybook stories”Source
Section titled “Source”packages/ui/src/forms/dropzone/dropzone.tsx