⚡ ComponentForge

File uploader

Inputs

Drag-and-drop zone plus hidden native input. Validates size, count, MIME/extension and custom rules; rejections surface in an assertive error region.

import { FileUploader } from "@componentforge/react";

Examples

Validated dropzone

Try dropping a >2 MB file or an unsupported type to see the rejection region.

Accessibility

  • Browse affordance is a real <label htmlFor> + visually-hidden <input type=file>: keyboard and screen-reader behaviour is native.
  • Rejection reasons render inside role="alert" so they interrupt politely-late but reliably.
  • Remove buttons carry per-file aria-labels ("Remove report.pdf").

Keyboard interactions

KeyAction
Enter / SpaceActivate Browse (native label/input behaviour).
TabReach browse control and each remove button.

API reference

Selected props — every component also spreads native HTML attributes.

PropTypeDefaultDescription
accept / multiple / maxSizeBytes / maxFilesDeclarative validation rules.
files / defaultFiles / onFilesChangeFile[][]Controlled/uncontrolled list of accepted files.
validate(file: File) => string | nullCustom rule; return a reason string to reject.