View as Markdown

API reference

@salmonui/inputs/file-upload

18 exported symbols: 1 component, 1 function, 10 interfaces and 6 types. Each name links its page with the signature, docs and members.

import { … } from '@salmonui/inputs/file-upload';

Components

  • FileUploadFile picker with a drop zone, validation, a file list and an optional upload queue. ref is a FileUploadApi; unknown props go to the native file input, classNam…

Functions

  • formatFileSizeFormats a byte count for people: formatFileSize(1536, 'en-US') is "1.5 kB", formatFileSize(1, 'de-DE') is "1 Byte". Uses 1024 steps, at most one fraction digit…

Interfaces

Types

  • FileErrorCodeWhy a file is invalid (type, tooSmall, tooLarge, tooMany) or failed (upload, remove).
  • FilePreloadA preloaded entry (defaultFiles / files): status defaults to 'uploaded'.
  • FileStatusStatus of one file entry.
  • FileUploadLocaleTextStrings: the trigger and buttons, one per status and one per error code; {0} is the file name, the limit or the count.
  • RemoveTransportOptional server removal of an uploaded file.
  • UploadTransportThe transport: resolves when the server accepted the file.