Skip to content

FileInput

A file input supporting both inline and drag-and-drop dropzone modes.

Choose file
function SingleFileStory(): React.JSX.Element {
const [value, setValue] = useState<File | null>(null);
return <FileInput label="Upload" onChange={setValue} value={value} />;
}
<SingleFileStory />
Choose files
function DropzoneStory(): React.JSX.Element {
const [value, setValue] = useState<File[]>([]);
return (
<FileInput
isMultiple
label="Upload"
mode="dropzone"
onChange={setValue}
value={value}
/>
);
}
<DropzoneStory />
PDF, PNG, or JPG up to 10 MB
Choose file
function WithDescriptionStory(): React.JSX.Element {
const [value, setValue] = useState<File | null>(null);
return (
<FileInput
description="PDF, PNG, or JPG up to 10 MB"
label="Upload"
onChange={setValue}
value={value}
/>
);
}
<WithDescriptionStory />
PNG or JPG only
Choose file
function AcceptImagesStory(): React.JSX.Element {
const [value, setValue] = useState<File | null>(null);
return (
<FileInput
accept="image/png, image/jpeg"
description="PNG or JPG only"
label="Upload"
onChange={setValue}
value={value}
/>
);
}
<AcceptImagesStory />
Choose file
<FileInput isDisabled label="Upload" onChange={() => {}} value={null} />
Choose file
<FileInput isLoading label="Upload" onChange={() => {}} value={null} />
Choose file
function RequiredStory(): React.JSX.Element {
const [value, setValue] = useState<File | null>(null);
return (
<FileInput isRequired label="Upload" onChange={setValue} value={value} />
);
}
<RequiredStory />
Choose file
<FileInput
label="Upload"
onChange={() => {}}
status={{message: 'A file is required.', type: 'error'}}
value={null}
/>
Choose file
<FileInput label="Upload" onChange={() => {}} size="sm" value={null} />
Choose file
<FileInput label="Upload" onChange={() => {}} size="lg" value={null} />
Choose files
<FileInput
isDisabled
isMultiple
label="Upload"
mode="dropzone"
onChange={() => {}}
value={[]}
/>
report.pdf
<FileInput
isReadOnly
label="Upload"
onChange={() => {}}
value={new File(['report'], 'report.pdf', {type: 'application/pdf'})}
/>

A file input supporting both inline and drag-and-drop dropzone modes.

When isMultiple: true, isOptional: false, isRequired: false

PropTypeDefaultDescription
isMultiple*true—Whether multiple files can be selected.
maxFilesnumber—Maximum number of files allowed.
onChange*(files: File[]) => void—Called when the selected files change.
value*File[]—Currently selected files.
acceptstring—Comma-separated MIME types or file extensions the input accepts.
classNamestring—Additional CSS class names applied to the root element.
data-testidstring—Test ID applied to the hidden file input.
descriptionReactNode—Supporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
isReadOnlybooleanfalseWhether the selected files are displayed without allowing interaction.
label*string—Field label text.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon shown before the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxSizenumber—Maximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstring—Placeholder text shown when no file is selected.
refRef<HTMLInputElement>—Ref forwarded to the hidden file input element.
size"sm" | "md" | "lg"'md'Visual size of the input.
statusInputStatus—Validation status displayed below the input.
styleCSSProperties—Inline styles applied to the root element.
isOptionalfalse—
isRequiredfalse—

When isMultiple: true, isOptional: true, isRequired: false

PropTypeDefaultDescription
isMultiple*true—Whether multiple files can be selected.
maxFilesnumber—Maximum number of files allowed.
onChange*(files: File[]) => void—Called when the selected files change.
value*File[]—Currently selected files.
acceptstring—Comma-separated MIME types or file extensions the input accepts.
classNamestring—Additional CSS class names applied to the root element.
data-testidstring—Test ID applied to the hidden file input.
descriptionReactNode—Supporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
isReadOnlybooleanfalseWhether the selected files are displayed without allowing interaction.
label*string—Field label text.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon shown before the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxSizenumber—Maximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstring—Placeholder text shown when no file is selected.
refRef<HTMLInputElement>—Ref forwarded to the hidden file input element.
size"sm" | "md" | "lg"'md'Visual size of the input.
statusInputStatus—Validation status displayed below the input.
styleCSSProperties—Inline styles applied to the root element.
isOptional*true—
isRequiredfalse—

When isMultiple: true, isOptional: false, isRequired: true

PropTypeDefaultDescription
isMultiple*true—Whether multiple files can be selected.
maxFilesnumber—Maximum number of files allowed.
onChange*(files: File[]) => void—Called when the selected files change.
value*File[]—Currently selected files.
acceptstring—Comma-separated MIME types or file extensions the input accepts.
classNamestring—Additional CSS class names applied to the root element.
data-testidstring—Test ID applied to the hidden file input.
descriptionReactNode—Supporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
isReadOnlybooleanfalseWhether the selected files are displayed without allowing interaction.
label*string—Field label text.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon shown before the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxSizenumber—Maximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstring—Placeholder text shown when no file is selected.
refRef<HTMLInputElement>—Ref forwarded to the hidden file input element.
size"sm" | "md" | "lg"'md'Visual size of the input.
statusInputStatus—Validation status displayed below the input.
styleCSSProperties—Inline styles applied to the root element.
isOptionalfalse—
isRequired*true—

When isMultiple: false, isOptional: false, isRequired: false

PropTypeDefaultDescription
isMultiplefalse—Whether multiple files can be selected.
maxFilesundefined—Maximum number of files allowed. Only applicable when isMultiple is true.
onChange*(file: File | null) => void—Called when the selected file changes.
value*File | null—Currently selected file.
acceptstring—Comma-separated MIME types or file extensions the input accepts.
classNamestring—Additional CSS class names applied to the root element.
data-testidstring—Test ID applied to the hidden file input.
descriptionReactNode—Supporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
isReadOnlybooleanfalseWhether the selected files are displayed without allowing interaction.
label*string—Field label text.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon shown before the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxSizenumber—Maximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstring—Placeholder text shown when no file is selected.
refRef<HTMLInputElement>—Ref forwarded to the hidden file input element.
size"sm" | "md" | "lg"'md'Visual size of the input.
statusInputStatus—Validation status displayed below the input.
styleCSSProperties—Inline styles applied to the root element.
isOptionalfalse—
isRequiredfalse—

When isMultiple: false, isOptional: true, isRequired: false

PropTypeDefaultDescription
isMultiplefalse—Whether multiple files can be selected.
maxFilesundefined—Maximum number of files allowed. Only applicable when isMultiple is true.
onChange*(file: File | null) => void—Called when the selected file changes.
value*File | null—Currently selected file.
acceptstring—Comma-separated MIME types or file extensions the input accepts.
classNamestring—Additional CSS class names applied to the root element.
data-testidstring—Test ID applied to the hidden file input.
descriptionReactNode—Supporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
isReadOnlybooleanfalseWhether the selected files are displayed without allowing interaction.
label*string—Field label text.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon shown before the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxSizenumber—Maximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstring—Placeholder text shown when no file is selected.
refRef<HTMLInputElement>—Ref forwarded to the hidden file input element.
size"sm" | "md" | "lg"'md'Visual size of the input.
statusInputStatus—Validation status displayed below the input.
styleCSSProperties—Inline styles applied to the root element.
isOptional*true—
isRequiredfalse—

When isMultiple: false, isOptional: false, isRequired: true

PropTypeDefaultDescription
isMultiplefalse—Whether multiple files can be selected.
maxFilesundefined—Maximum number of files allowed. Only applicable when isMultiple is true.
onChange*(file: File | null) => void—Called when the selected file changes.
value*File | null—Currently selected file.
acceptstring—Comma-separated MIME types or file extensions the input accepts.
classNamestring—Additional CSS class names applied to the root element.
data-testidstring—Test ID applied to the hidden file input.
descriptionReactNode—Supporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
isReadOnlybooleanfalseWhether the selected files are displayed without allowing interaction.
label*string—Field label text.
labelEndReactNode—Content shown at the end of the label row, such as a link. It renders outside the label, so it does not focus the control or change its accessible name. It stays visible when isLabelHidden is true.
labelIconIconComponent—Icon shown before the label.
labelTooltipReactNode—Tooltip content shown next to the label.
maxSizenumber—Maximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstring—Placeholder text shown when no file is selected.
refRef<HTMLInputElement>—Ref forwarded to the hidden file input element.
size"sm" | "md" | "lg"'md'Visual size of the input.
statusInputStatus—Validation status displayed below the input.
styleCSSProperties—Inline styles applied to the root element.
isOptionalfalse—
isRequired*true—