Skip to main content

Interface: FileInputProps

Defined in: react/src/components/FileInput/index.tsx:18

Properties​

accept?​

optional accept?: string;

Defined in: react/src/components/FileInput/index.tsx:28

Which files to take, written the way the HTML attribute is: a comma separated list of extensions (.wav), MIME types (audio/wav) and type groups (audio/*).

The browser treats it as a hint to the picker, not a rule. A person can switch the picker to "All Files", so what arrives is checked again here, and anything that does not match goes to onReject instead.


children​

children: ReactNode;

Defined in: react/src/components/FileInput/index.tsx:57

Normally a FileInput.Trigger, and whatever shows what was picked.


disabled?​

optional disabled?: boolean;

Defined in: react/src/components/FileInput/index.tsx:38

Refuse to open the picker, and mark every part with [data-disabled].

Default​

false

multiple?​

optional multiple?: boolean;

Defined in: react/src/components/FileInput/index.tsx:33

Let more than one file be picked at a time.

Default​

false

onChange?​

optional onChange?: (files) => void;

Defined in: react/src/components/FileInput/index.tsx:47

Called with the files that were picked and match accept.

It is not called at all when the picker is dismissed, or when every file picked was rejected — an empty array never arrives, so there is no need to tell "nothing was chosen" from "the choice was cleared".

Parameters​

ParameterType
filesFile[]

Returns​

void


onReject?​

optional onReject?: (files) => void;

Defined in: react/src/components/FileInput/index.tsx:54

Called with the files that were picked and do not match accept, so that the reason can be shown. Given alongside onChange when a selection held both, and after it, so a list of rejected files can be cleared in onChange and filled here.

Parameters​

ParameterType
filesFile[]

Returns​

void