Elements

Components

File Upload

FileUpload, dressed in the paper-and-ink system: a dashed dropzone that floods with subtle light on drag-over, and accepted files as loose hairline slips. The parts — Root, Label, Trigger, Dropzone, HiddenInput, ItemGroup, Item, ItemName, ItemSizeText, ItemPreview, ItemPreviewImage, ItemDeleteTrigger, ClearTrigger, Context.

#Basic usage

file-upload/basic Vue React

#Props

#ClearTrigger

A styled part — no props of its own; it takes the anatomy's shared styling.

#Dropzone

PropTypeDefaultDescription
disableClickboolean | undefinedWhether to disable the click event on the dropzone

#HiddenInput

A styled part — no props of its own; it takes the anatomy's shared styling.

#ItemDeleteTrigger

A styled part — no props of its own; it takes the anatomy's shared styling.

#ItemGroup

PropTypeDefaultDescription
typeItemType | undefined—

#ItemName

A styled part — no props of its own; it takes the anatomy's shared styling.

#ItemPreviewImage

A styled part — no props of its own; it takes the anatomy's shared styling.

#ItemPreview

PropTypeDefaultDescription
typestring'.*'The file type to match against. Matches all file types by default.

#ItemSizeText

A styled part — no props of its own; it takes the anatomy's shared styling.

#Item

PropTypeDefaultDescription
fileFile—
typeItemType | undefined—

#Label

A styled part — no props of its own; it takes the anatomy's shared styling.

#Root

PropTypeDefaultDescription
sizeString as PropType<"sm" | "md" | "lg">"md"One rung of the control-height ladder for the trigger.
acceptRecord<string, string[]> | fileUpload.FileMimeType | fileUpload.FileMimeType[]The accept file types
acceptedFilesFile[]The controlled accepted files
allowDropbooleantrueWhether to allow drag and drop in the dropzone element
capture'user' | 'environment'The default camera to use when capturing media
defaultAcceptedFilesFile[]The default accepted files
directorybooleanWhether to accept directories, only works in webkit browsers
disabledbooleanWhether the file input is disabled
idstringThe unique identifier of the machine.
idsPartial<{ root: string; dropzone: string; hiddenInput: string; trigger: string; label: string; item(id: string): string; itemName(id: string): string; itemSizeText(id: string): string; itemPreview(id: string): string; }>The ids of the elements. Useful for composition.
invalidbooleanWhether the file input is invalid
localestring"en-US"The current locale. Based on the BCP 47 definition.
maxFilesnumber1The maximum number of files
maxFileSizenumberInfinityThe maximum file size in bytes
minFileSizenumber0The minimum file size in bytes
namestringThe name of the underlying file input
preventDocumentDropbooleantrueWhether to prevent the drop event on the document
readOnlybooleanWhether the file input is read-only
requiredbooleanWhether the file input is required
transformFiles(files: File[]) => Promise<File[]>Function to transform the files
translationsfileUpload.IntlTranslationsThe localized messages to use.
validate(file: File, details: fileUpload.FileValidateDetails) => fileUpload.FileError[] | nullFunction to validate a file

#Trigger

A styled part — no props of its own; it takes the anatomy's shared styling.