UseFileInputResult
Properties
Section titled “Properties”addFiles
Section titled “addFiles”addFiles: (candidates) => void;Add several candidates, applying every rule.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
candidates | File[] |
Returns
Section titled “Returns”void
announcement
Section titled “announcement”announcement: string;Text for the polite live region. Changes only when there is something to say.
clear: () => void;Remove every file.
Returns
Section titled “Returns”void
disabled
Section titled “disabled”disabled: boolean;dragging
Section titled “dragging”dragging: boolean;A drag carrying files is currently over the drop zone.
entries
Section titled “entries”entries: FileEntry[];One entry per file, with a stable key and an optional preview URL.
files: File[];The selected files.
full: boolean;maxFiles reached, or a single-file field that already has one.
handleBlur
Section titled “handleBlur”handleBlur: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | FocusEvent<HTMLElement> |
Returns
Section titled “Returns”void
handleDragEnter
Section titled “handleDragEnter”handleDragEnter: (event) => void;Bind to onDragEnter. This is the handler that counts the drag depth, so
binding onDragOver to it as well makes the highlight stick.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | DragEvent<HTMLElement> |
Returns
Section titled “Returns”void
handleDragLeave
Section titled “handleDragLeave”handleDragLeave: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | DragEvent<HTMLElement> |
Returns
Section titled “Returns”void
handleDragOver
Section titled “handleDragOver”handleDragOver: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | DragEvent<HTMLElement> |
Returns
Section titled “Returns”void
handleDrop
Section titled “handleDrop”handleDrop: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | DragEvent<HTMLElement> |
Returns
Section titled “Returns”void
handleFocus
Section titled “handleFocus”handleFocus: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | FocusEvent<HTMLElement> |
Returns
Section titled “Returns”void
handleInputChange
Section titled “handleInputChange”handleInputChange: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | ChangeEvent<HTMLInputElement> |
Returns
Section titled “Returns”void
ids: object;announcement
Section titled “announcement”announcement: string;input: string;label: string;Only referenced when label is a node rather than a string.
list: string;root: string;zone: string;inputRef
Section titled “inputRef”inputRef: object;Structural rather than RefObject: in @types/react 18 RefObject.current
is readonly, in 19 it is mutable. Declaring the shape keeps this assignable
under both, which matters because react >= 18 is a peer.
current
Section titled “current”current: HTMLInputElement | null;multiple
Section titled “multiple”multiple: boolean;open: () => void;Open the native picker. The drop zone calls this on click and on Enter/Space.
Returns
Section titled “Returns”void
readOnly
Section titled “readOnly”readOnly: boolean;removeAt
Section titled “removeAt”removeAt: (index) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
index | number |
Returns
Section titled “Returns”void
removeRefs
Section titled “removeRefs”removeRefs: object;One slot per rendered remove button, indexed like entries.
current
Section titled “current”current: (HTMLElement | null)[];sizeOf
Section titled “sizeOf”sizeOf: (file) => string;A human-readable size for one file.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
file | File |
Returns
Section titled “Returns”string
zoneRef
Section titled “zoneRef”zoneRef: object;The drop zone, so focus can return to it when the last file goes.
current
Section titled “current”current: HTMLElement | null;