Fluxo UIFluxo UIv0.1.1

FileUpload

A drag-and-drop file upload component with progress tracking, image previews, and validation.

Basic Usage

Image Upload

Drag and drop or click to upload images with progress tracking and preview.

Drag & drop files here or browseAccepted: image/* • Max: 5 MB • Up to 5 files
import { FileUpload } from 'fluxo-ui';

<FileUpload
  accept="image/*"
  multiple
  maxFileSize={5 * 1024 * 1024}
  maxFiles={5}
  showPreview
  onFilesSelect={(files) => console.log('Selected:', files)}
  onUpload={async (file, onProgress) => {
    for (let i = 0; i <= 100; i += 10) {
      await new Promise((r) => setTimeout(r, 200));
      onProgress(i);
    }
  }}
/>

Image Preview

Enable showPreview to display thumbnail previews for uploaded image files.

Image Preview

Uploaded images show thumbnail previews with progress bars during upload.

Drag & drop files here or browseAccepted: image/* • Up to 4 files
import { FileUpload } from 'fluxo-ui';

<FileUpload
  accept="image/*"
  multiple
  maxFiles={4}
  showPreview
  onUpload={async (file, onProgress) => {
    // simulate upload
    for (let i = 0; i <= 100; i += 20) {
      await new Promise((r) => setTimeout(r, 300));
      onProgress(i);
    }
  }}
/>

Validation

Use accept, maxFileSize, and customValidator to enforce file constraints.

File Validation

Restrict file types, enforce size limits, and add custom validation rules. Invalid files display inline error messages.

Drag & drop files here or browseAccepted: .pdf,.doc,.docx • Max: 2 MB • Up to 3 files
import { FileUpload } from 'fluxo-ui';

<FileUpload
  accept=".pdf,.doc,.docx"
  multiple
  maxFileSize={2 * 1024 * 1024}
  maxFiles={3}
  customValidator={(file) => {
    if (file.name.includes(' ')) {
      return 'File name must not contain spaces';
    }
    return undefined;
  }}
  onFilesSelect={(files) => console.log('Valid files:', files)}
/>

Import

import { FileUpload } from 'fluxo-ui';

Props

accept
string

Accepted file types (e.g. "image/*", ".pdf,.doc").

multiple
boolean"false"

Allow multiple file selection.

maxFileSize
number

Maximum file size in bytes.

maxFiles
number

Maximum number of files allowed.

disabled
boolean"false"

Disable the upload zone.

showPreview
boolean"true"

Show image previews for uploaded files.

dropzoneContent
ReactNode

Custom content for the dropzone area.

onFilesSelect
(files: File[]) => void

Called when files are selected.

onFileRemove
(file: UploadFile) => void

Called when a file is removed from the list.

onUpload
(file: File, onProgress: (percent: number) => void) => Promise<void>

Upload handler with progress callback.

customValidator
(file: File) => string | undefined

Custom validation function returning an error message.

className
string

Additional CSS class for the container.

Features

Drag & Drop

Drop files directly onto the upload zone with visual hover feedback.

Progress Tracking

Real-time upload progress bars for each file being uploaded.

Image Previews

Automatic thumbnail generation for uploaded image files.

File Validation

Built-in type and size validation plus custom validator support.

Multiple Files

Upload multiple files at once with configurable file count limits.

Accessibility

Keyboard accessible with ARIA labels and role attributes.