Rxova
Skip to content

FileInputProps

optional accept?: string;

accept string, exactly as <input accept> takes it.


optional announce?: (event) => string;

Announcement text for the live region. Return '' to say nothing.

ParameterType
event{ added?: number; files: File[]; rejected?: FileAttempt[]; type: "add" | "remove" | "reject"; }
event.added?number
event.filesFile[]
event.rejected?FileAttempt[]
event.type"add" | "remove" | "reject"

string


optional aria-describedby?: string;

ids of external error/help text.


optional aria-label?: string;

Accessible name, when there is no visible text to point label at. Wins over label if both are given.


optional autoFocus?: boolean;

Focus the field on mount.

false

optional className?: string;

optional dedupe?: boolean;

Treat same name + size + timestamp as the same file.

true

optional defaultValue?: File[];

Uncontrolled initial list. Ignored when value is provided.


optional disabled?: boolean;

optional hint?: ReactNode;

Text inside the drop zone.

a stock sentence

optional id?: string;

Base id; the input, drop zone, list and live region derive ids from it.


optional invalid?: boolean;

Sets aria-invalid and data-invalid.


optional label?: ReactNode;

Accessible name for the field. Not rendered — supply your own visible <label htmlFor={${id}-input}> when the design calls for one, exactly as every other input in the suite expects. A node is exposed through a hidden element, since aria-label only takes a string.


optional maxFiles?: number;

Maximum number of files. Ignored when multiple is false.


optional maxSize?: number;

Largest allowed file, in bytes.


optional minSize?: number;

Smallest allowed file, in bytes.


optional multiple?: boolean;

Accept more than one file.

false, like the native input

optional name?: string;

Name for the underlying <input type="file">.


optional onAdd?: (file, files) => void;

Fires for each file actually added, after it passed every rule.

ParameterType
fileFile
filesFile[]

void


optional onBlur?: (event) => void;
ParameterType
eventFocusEvent<HTMLElement>

void


optional onChange?: (files) => void;
ParameterType
filesFile[]

void


optional onFocus?: (event) => void;
ParameterType
eventFocusEvent<HTMLElement>

void


optional onReject?: (attempt) => void;

Fires for each file refused, with a machine-readable reason.

ParameterType
attemptFileAttempt

void


optional onRemove?: (file, index, files) => void;

Fires for each file removed, with the index it occupied.

ParameterType
fileFile
indexnumber
filesFile[]

void


optional onWarn?: (warning) => void;

Called in development whenever a prop is rejected or coerced — see FileWarning. When omitted, the same warnings go to console.warn. The entire path is stripped from production builds.

ParameterType
warningFileWarning

void


optional previews?: boolean;

Create object URLs for image files, revoked automatically on removal and unmount. Off by default: a URL that is never revoked is a memory leak, and the caller should opt into the lifecycle deliberately.

false

optional readOnly?: boolean;

Show the selection but refuse changes.


optional removeLabel?: (file) => string;

Accessible name for one file’s remove button.

ParameterType
fileFile

string

Remove ${name}


optional renderFile?: (state) => ReactNode;

Custom rendering for one file row.

ParameterType
stateFileEntryState

ReactNode


optional required?: boolean;

optional style?: CSSProperties;

optional validate?: (file, existing) => string | boolean;

Final say: true, false, or a string explaining the refusal.

ParameterType
fileFile
existingFile[]

string | boolean


optional value?: File[];

Controlled list of files.