ValyroUI Русская версия

File Uploader

File uploads. Free, MIT · Forms and input › Files and images

id, aria-describedby and aria-invalid (e.g. from FormField) go to the dropzone button.

Installation

npx valyro-cli@latest add file-uploader
npx shadcn@latest add https://valyro.xyz/r/file-uploader.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { FileUploader } from 'valyro-ui';

Props

PropTypeDefault
valueFileItem[]File list, including rejected files (status error). Apps drive status/progress while uploading.
defaultValueFileItem[][]Initial value when uncontrolled.
onValueChange(items: FileItem[]) => voidCalled with the new value when it changes.
onFilesAdded(items: FileItem[]) => voidCalled with the newly accepted files — the place to start uploads.
acceptstringSame syntax as <input accept>: image/*,.pdf.
maxSizenumberMaximum size per file, in bytes.
maxFilesnumberMaximum number of accepted files; extra files are listed as rejected. Applies only with multiple.
multiplebooleantrueAllow several files; when false, a new pick replaces the current file.
disabledbooleanfalseDisables the drop zone, the file picker and the remove buttons.
invalidbooleanfalseDanger border on the drop zone (aria-invalid).
titleReactNodeDrop zone heading. Defaults to "Click to upload or drag and drop"; labels.drop replaces it while dragging.
hintReactNodeText under the title. Defaults to a summary of accept, maxSize and maxFiles.
localestringLocale for file sizes and progress. Defaults to the ThemeProvider locale, then the browser's.
labelsPartial<FileUploaderLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Emoji Picker · Next: Image Cropper · All Forms and input