Attach the context
Project files
Add a brief or notes. This example keeps the selected files on your device.
Collects validated files through browse or drop, with optional upload progress, cancellation, and retry.
Project files
Add a brief or notes. This example keeps the selected files on your device.
Three ways in. They share one source, so the pixels match whichever you pick.
npm install @noorddev/vlak-react
// once, next to your app's root
import "@noorddev/vlak-react/css";
import { FileUpload } from "@noorddev/vlak-react";Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/file-upload.
npx @noorddev/vlak-cli add file-upload
The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.
npx shadcn add https://vlak.dev/r/file-upload.json
The same registry item, installed by shadcn's CLI.
<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />
No React. Link vlak.css and use the markup and classes below.
import { FileUpload } from "@noorddev/vlak-react";
<FileUpload label="Project files" name="attachments" accept=".pdf,.txt" maxFiles={5} maxSize={10 * 1024 * 1024} description="PDF or text, up to 10 MB each" />Validated file selection, with an optional cancellable upload transport.
| Prop | Type | Default | Description |
|---|---|---|---|
value | File[] | ||
defaultValue | File[] | [] | |
onValueChange | (files: File[]) => void | ||
accept | string | ||
multiple | boolean | true | |
maxFiles | number | ||
maxSize | number | ||
disabled | boolean | ||
name | string | ||
label | string | "Choose files" | |
description | ReactNode | "Drop files here or browse" | |
onReject | (rejections: FileUploadRejection[]) => void | ||
onUpload | (file: File, context: FileUploadContext) => Promise<void> | Optional transport supplied by the app. Omit to collect files without uploading. |
Also accepts Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue">.
| Keys | Does |
|---|---|
| Tab, Enter, Space | Reaches the native file picker and labeled Remove, Cancel, and Retry actions. |
<div class="rs-file-upload"><div class="rs-file-upload-drop"><span class="rs-file-upload-title">Choose files</span><span class="rs-file-upload-description" id="files-hint">Drop files here or browse</span><input class="rs-file-upload-input" type="file" multiple aria-label="Choose files" aria-describedby="files-hint" /></div></div>