API reference: @salmonui/inputs/file-upload
FileUploadPropsinterface
import type { FileUploadProps } from '@salmonui/inputs/file-upload';interface FileUploadProps extends FieldCommonProps, NativeInput {
readonly files?: readonly (FileEntry | FilePreload)[] | undefined;
readonly defaultFiles?: readonly (FileEntry | FilePreload)[] | undefined;
readonly onFilesChange?: ((files: readonly FileEntry[], details: FilesChangeDetails) => void) | undefined;
readonly accept?: string | undefined;
readonly multiple?: boolean | undefined;
readonly directory?: boolean | undefined;
readonly minSize?: number | undefined;
readonly maxSize?: number | undefined;
readonly maxFiles?: number | undefined;
readonly upload?: UploadTransport | undefined;
readonly remove?: RemoveTransport | undefined;
readonly autoUpload?: boolean | undefined;
readonly concurrency?: number | undefined;
readonly dropTarget?: RefObject<Element | null> | undefined;
readonly dropEffect?: 'copy' | 'move' | 'link' | 'none' | undefined;
readonly showFileList?: boolean | undefined;
readonly renderFile?: ((ctx: FileRenderContext) => ReactNode) | undefined;
readonly renderTrigger?: ((ctx: {
readonly open: () => void;
readonly text: string;
}) => ReactNode) | undefined;
readonly localeText?: FileUploadLocaleText | undefined;
readonly locale?: string | undefined;
readonly onBeforeFilesAdd?: ((event: BeforeFilesAddEvent) => void) | undefined;
readonly onBeforeUpload?: ((event: BeforeFileEvent) => void) | undefined;
readonly onUploadProgress?: ((file: FileEntry) => void) | undefined;
readonly onUploadSuccess?: ((file: FileEntry, result: unknown) => void) | undefined;
readonly onUploadError?: ((file: FileEntry, reason: unknown) => void) | undefined;
readonly onUploadComplete?: ((files: readonly FileEntry[]) => void) | undefined;
readonly onBeforeRemove?: ((event: BeforeFileEvent) => void) | undefined;
readonly onBeforeClear?: ((event: BeforeClearEvent) => void) | undefined;
readonly className?: string | undefined;
readonly style?: CSSProperties | undefined;
readonly classNames?: {
readonly trigger?: string;
readonly list?: string;
readonly item?: string;
readonly label?: string;
readonly description?: string;
readonly error?: string;
} | undefined;
readonly ref?: Ref<FileUploadApi> | undefined;
}
| Name | Signature | Description |
|---|---|---|
labeloptionalinherited | label?: ReactNode; | |
descriptionoptionalinherited | description?: ReactNode; | |
errorMessageoptionalinherited | errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) | ReactNode; | Error text (or a function of the errors) shown while the field is invalid. |
invalidoptionalinherited | invalid?: boolean; | Forces the error state. |
validationoptionalinherited | validation?: FieldValidation; | Rules in the Data Grid vocabulary. |
validateOnoptionalinherited | validateOn?: ValidateOn; | When errors appear; default the |
sizeoptionalinherited | size?: FieldSize; | Metric set. Default |
filesoptional | readonly files?: readonly (FileEntry | FilePreload)[] | undefined; | Controlled list; preloaded entries default to status |
defaultFilesoptional | readonly defaultFiles?: readonly (FileEntry | FilePreload)[] | undefined; | |
onFilesChangeoptional | readonly onFilesChange?: ((files: readonly FileEntry[], details: FilesChangeDetails) => void) | undefined; | |
acceptoptional | readonly accept?: string | undefined; | Extensions and MIME types ( |
multipleoptional | readonly multiple?: boolean | undefined; | |
directoryoptional | readonly directory?: boolean | undefined; | Picks and drops folders ( |
minSizeoptional | readonly minSize?: number | undefined; | Bytes; smaller files get error |
maxSizeoptional | readonly maxSize?: number | undefined; | Bytes; larger files get error |
maxFilesoptional | readonly maxFiles?: number | undefined; | Files beyond the limit get error |
uploadoptional | readonly upload?: UploadTransport | undefined; | Transport; without it the files only submit with the form. |
removeoptional | readonly remove?: RemoveTransport | undefined; | Server removal of uploaded files. |
autoUploadoptional | readonly autoUpload?: boolean | undefined; | Uploads as soon as files are added. Default |
concurrencyoptional | readonly concurrency?: number | undefined; | Parallel uploads; |
dropTargetoptional | readonly dropTarget?: RefObject<Element | null> | undefined; | Another element that accepts drops. |
dropEffectoptional | readonly dropEffect?: 'copy' | 'move' | 'link' | 'none' | undefined; |
|
showFileListoptional | readonly showFileList?: boolean | undefined; | Default |
renderFileoptional | readonly renderFile?: ((ctx: FileRenderContext) => ReactNode) | undefined; | Content of one list item. |
renderTriggeroptional | readonly renderTrigger?: ((ctx: {
readonly open: () => void;
readonly text: string;
}) => ReactNode) | undefined; | Content of the drop zone button. |
localeTextoptional | readonly localeText?: FileUploadLocaleText | undefined; | |
localeoptional | readonly locale?: string | undefined; | Locale of file sizes. Default |
onBeforeFilesAddoptional | readonly onBeforeFilesAdd?: ((event: BeforeFilesAddEvent) => void) | undefined; | |
onBeforeUploadoptional | readonly onBeforeUpload?: ((event: BeforeFileEvent) => void) | undefined; | |
onUploadProgressoptional | readonly onUploadProgress?: ((file: FileEntry) => void) | undefined; | |
onUploadSuccessoptional | readonly onUploadSuccess?: ((file: FileEntry, result: unknown) => void) | undefined; | |
onUploadErroroptional | readonly onUploadError?: ((file: FileEntry, reason: unknown) => void) | undefined; | |
onUploadCompleteoptional | readonly onUploadComplete?: ((files: readonly FileEntry[]) => void) | undefined; | |
onBeforeRemoveoptional | readonly onBeforeRemove?: ((event: BeforeFileEvent) => void) | undefined; | |
onBeforeClearoptional | readonly onBeforeClear?: ((event: BeforeClearEvent) => void) | undefined; | |
classNameoptional | readonly className?: string | undefined; | |
styleoptional | readonly style?: CSSProperties | undefined; | |
classNamesoptional | readonly classNames?: {
readonly trigger?: string;
readonly list?: string;
readonly item?: string;
readonly label?: string;
readonly description?: string;
readonly error?: string;
} | undefined; | Part classes: |
refoptional | readonly ref?: Ref<FileUploadApi> | undefined; |