fma-ds

File Upload

Picks files by dragging them in, pasting them or browsing, and lists them; it doesn't upload.

FormsoriginalMITChangelogRegistry JSON

Overview

FileUpload holds the use-file-upload state — accept (.pdf,.docx, image/*), maxSize, multiple + maxFiles, uncontrolled (defaultValue) or controlled (value/onChange), isDisabled — and the parts read it:

  • `FileUploadDropzone`: a react-aria DropZone, with keyboard and paste support. By default an icon, title, description and a trigger, highlighted with accent while a drag is over it.
  • `FileUploadTrigger`: a FileTrigger button.
  • `FileUploadList`: renders each file with a function.
  • `FileUploadItem`: a file-type icon or image thumbnail, name, size, optional progress, error, extra actions such as retry, and a remove button that keeps focus in the widget.
  • `FileUploadError`: a FieldError with the validation errors (type, size, count).

Upload progress and retries stay with the app, keyed by file id.

Built-in text is in English; translate labels and error messages with i18n.

Installation

  1. 1

    Register the @fma-ds namespace in components.json (once)

    components.json
    {  "registries": {    "@fma-ds": "https://ds.fmartinsandre.dev.br/r/{name}.json"  }}
  2. 2

    Add the item

    pnpm dlx shadcn@latest add @fma-ds/file-upload

    Files land in components/fma-ds/file-upload.tsx; npm and registry dependencies are installed along with them.

Dependencies

npm
cn@^0.5.0lucide-react@^1.61.0react-aria-components@^1.22.1