v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS
FileUpload
Native file selection with honest validation feedback.
Interactive preview
Usage
import { FileUpload } from "@devvy-ui/react";
<FileUpload label="Project files" name="files" multiple accept=".txt,image/*" onFilesChange={setFiles} />API reference
Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:
| Prop | Type | Default | Description |
|---|---|---|---|
| maxSize | number | 10485760 | Per-file byte limit. |
| maxFiles | number | 10 | Maximum count when multiple is set. |
| onFilesChange | (files: File[]) => void | — | Accepted selection or reset. |
| onReject | (message: string) => void | — | Validation feedback. |
Accessibility & behavior
Platform Behavior & Guidelines
Checks client-side type, count and byte limits, clears rejected input, and reports selected files. Applications must validate again on the server and own upload/cancellation.
Source ownership
Run npx @devvy-ui/cli init once in your React project, then add the source:
npx @devvy-ui/cli add file-uploadMake the source yours.
Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.
FileUpload.tsxREACT / TSX
Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.