Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

FileUpload

Attach supporting documents to a request.

Preview

Live preview

Changes apply to this preview only.

Brief, references and signed scope. PDF, PNG or JPG, up to 5 MB each.

No files selected

No attachment ready.

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Image previews

Image files show a local object URL thumbnail; other formats keep the document icon. showPreviews={false} restores the icon-only list.

Open preview

Uncontrolled

defaultFiles seeds the list; without a files prop the component owns every change and still calls onFilesChange.

Open preview

States

An external error marks the field invalid; disabled removes the trigger, the input and every remove button from the form.

Open preview

Usage

Accepted types and size checks improve feedback; validate uploads again on the server.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluFileUploadProps

Type source
PimoluFileUploadProps public API
NameTypeDefaultDescription
filesFile[] | undefined—Controlled list of files.
defaultFilesFile[] | undefinedan empty listInitial files when uncontrolled. Defaults to an empty list.
onFilesChange((files: File[]) => void) | undefined—Called with the complete next list after a selection or a removal.
acceptstring | undefined—Native accept string, for example `"image/*,.pdf"`. Used both by the file input and by the validation of dropped or selected files.
multipleboolean | undefinedtrueAllow more than one file. Defaults to true.
maxFilesnumber | undefined—Maximum number of files kept. Omit for no limit.
maxSizenumber | undefined—Maximum size of a single file, in bytes. Omit for no limit.
disabledboolean | undefinedfalseDisable the trigger, the input and every remove button.
labelReactNode—Visible label.
descriptionReactNode—Supporting text below the label.
errorReactNode—Error text; also marks the control as invalid.
validateFilePimoluFileValidator | undefined—Extra per-file validation, applied after accept and maxSize.
buttonLabelstring | undefined—Text of the trigger button.
emptyTextstring | undefined"No files selected"Text shown when no file is selected.
removeFileLabel((file: File) => string) | undefined`Remove <name>`Accessible name of a remove button. Defaults to `Remove <name>`.
showPreviewsboolean | undefinedtrueShow an image thumbnail for image files. Other files keep the document icon. Defaults to true.
defaultValuestring | number | readonly string[] | undefined—Standard React/HTML attribute.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLDivElement> | undefined—Standard React/HTML attribute.
files

File[] | undefined

No default extracted.

Controlled list of files.

defaultFiles

File[] | undefined

Default: an empty list

Initial files when uncontrolled. Defaults to an empty list.

onFilesChange

((files: File[]) => void) | undefined

No default extracted.

Called with the complete next list after a selection or a removal.

accept

string | undefined

No default extracted.

Native accept string, for example `"image/*,.pdf"`. Used both by the file input and by the validation of dropped or selected files.

multiple

boolean | undefined

Default: true

Allow more than one file. Defaults to true.

maxFiles

number | undefined

No default extracted.

Maximum number of files kept. Omit for no limit.

maxSize

number | undefined

No default extracted.

Maximum size of a single file, in bytes. Omit for no limit.

disabled

boolean | undefined

Default: false

Disable the trigger, the input and every remove button.

label

ReactNode

No default extracted.

Visible label.

description

ReactNode

No default extracted.

Supporting text below the label.

error

ReactNode

No default extracted.

Error text; also marks the control as invalid.

validateFile

PimoluFileValidator | undefined

No default extracted.

Extra per-file validation, applied after accept and maxSize.

buttonLabel

string | undefined

No default extracted.

Text of the trigger button.

emptyText

string | undefined

Default: "No files selected"

Text shown when no file is selected.

removeFileLabel

((file: File) => string) | undefined

Default: `Remove <name>`

Accessible name of a remove button. Defaults to `Remove <name>`.

showPreviews

boolean | undefined

Default: true

Show an image thumbnail for image files. Other files keep the document icon. Defaults to true.

defaultValue

string | number | readonly string[] | undefined

No default extracted.

Standard React/HTML attribute.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLDivElement> | undefined

No default extracted.

Standard React/HTML attribute.

Accessibility

  • Keep a labelled file-input path, clear rejection messages and accessible removal actions.
Read the accessibility guide →