Skip to content

FileInput

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

Choose file
<SingleFileStory />
Choose files
<DropzoneStory />
PDF, PNG, or JPG up to 10 MB
Choose file
<WithDescriptionStory />
PNG or JPG only
Choose file
<AcceptImagesStory />
Choose file
<FileInput isDisabled label="Upload" onChange={() => {}} value={null} />
Choose file
<FileInput isLoading label="Upload" onChange={() => {}} value={null} />
Choose file
<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={[]}
/>

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

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

PropTypeDefaultDescription
isMultiple*trueWhether multiple files can be selected.
maxFilesnumberMaximum number of files allowed.
onChange*(files: File[]) => voidCalled when the selected files change.
value*File[]Currently selected files.
acceptstringComma-separated MIME types or file extensions the input accepts.
classNamestringAdditional CSS class names applied to the root element.
data-testidstringTest ID applied to the hidden file input.
descriptionReactNodeSupporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*stringField label text.
labelIconIconComponentIcon shown before the label.
labelTooltipReactNodeTooltip content shown next to the label.
maxSizenumberMaximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstringPlaceholder 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.
statusInputStatusValidation status displayed below the input.
styleCSSPropertiesInline styles applied to the root element.
isOptionalfalse
isRequiredfalse

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

PropTypeDefaultDescription
isMultiple*trueWhether multiple files can be selected.
maxFilesnumberMaximum number of files allowed.
onChange*(files: File[]) => voidCalled when the selected files change.
value*File[]Currently selected files.
acceptstringComma-separated MIME types or file extensions the input accepts.
classNamestringAdditional CSS class names applied to the root element.
data-testidstringTest ID applied to the hidden file input.
descriptionReactNodeSupporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*stringField label text.
labelIconIconComponentIcon shown before the label.
labelTooltipReactNodeTooltip content shown next to the label.
maxSizenumberMaximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstringPlaceholder 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.
statusInputStatusValidation status displayed below the input.
styleCSSPropertiesInline styles applied to the root element.
isOptional*true
isRequiredfalse

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

PropTypeDefaultDescription
isMultiple*trueWhether multiple files can be selected.
maxFilesnumberMaximum number of files allowed.
onChange*(files: File[]) => voidCalled when the selected files change.
value*File[]Currently selected files.
acceptstringComma-separated MIME types or file extensions the input accepts.
classNamestringAdditional CSS class names applied to the root element.
data-testidstringTest ID applied to the hidden file input.
descriptionReactNodeSupporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*stringField label text.
labelIconIconComponentIcon shown before the label.
labelTooltipReactNodeTooltip content shown next to the label.
maxSizenumberMaximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstringPlaceholder 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.
statusInputStatusValidation status displayed below the input.
styleCSSPropertiesInline styles applied to the root element.
isOptionalfalse
isRequired*true

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

PropTypeDefaultDescription
isMultiplefalseWhether multiple files can be selected.
maxFilesundefinedMaximum number of files allowed. Only applicable when isMultiple is true.
onChange*(file: File | null) => voidCalled when the selected file changes.
value*File | nullCurrently selected file.
acceptstringComma-separated MIME types or file extensions the input accepts.
classNamestringAdditional CSS class names applied to the root element.
data-testidstringTest ID applied to the hidden file input.
descriptionReactNodeSupporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*stringField label text.
labelIconIconComponentIcon shown before the label.
labelTooltipReactNodeTooltip content shown next to the label.
maxSizenumberMaximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstringPlaceholder 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.
statusInputStatusValidation status displayed below the input.
styleCSSPropertiesInline styles applied to the root element.
isOptionalfalse
isRequiredfalse

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

PropTypeDefaultDescription
isMultiplefalseWhether multiple files can be selected.
maxFilesundefinedMaximum number of files allowed. Only applicable when isMultiple is true.
onChange*(file: File | null) => voidCalled when the selected file changes.
value*File | nullCurrently selected file.
acceptstringComma-separated MIME types or file extensions the input accepts.
classNamestringAdditional CSS class names applied to the root element.
data-testidstringTest ID applied to the hidden file input.
descriptionReactNodeSupporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*stringField label text.
labelIconIconComponentIcon shown before the label.
labelTooltipReactNodeTooltip content shown next to the label.
maxSizenumberMaximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstringPlaceholder 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.
statusInputStatusValidation status displayed below the input.
styleCSSPropertiesInline styles applied to the root element.
isOptional*true
isRequiredfalse

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

PropTypeDefaultDescription
isMultiplefalseWhether multiple files can be selected.
maxFilesundefinedMaximum number of files allowed. Only applicable when isMultiple is true.
onChange*(file: File | null) => voidCalled when the selected file changes.
value*File | nullCurrently selected file.
acceptstringComma-separated MIME types or file extensions the input accepts.
classNamestringAdditional CSS class names applied to the root element.
data-testidstringTest ID applied to the hidden file input.
descriptionReactNodeSupporting text rendered below the label.
isDisabledbooleanfalseWhether the input is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
isLoadingbooleanfalseWhether the input is in a loading state.
label*stringField label text.
labelIconIconComponentIcon shown before the label.
labelTooltipReactNodeTooltip content shown next to the label.
maxSizenumberMaximum file size in bytes.
mode"input" | "dropzone"'input'Display mode: inline input or drag-and-drop dropzone.
placeholderstringPlaceholder 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.
statusInputStatusValidation status displayed below the input.
styleCSSPropertiesInline styles applied to the root element.
isOptionalfalse
isRequired*true