Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Forms

FileUpload

Free19.2 KB gzipped

File picker with drag and drop, validation, and a file list. FileUpload.List is the standalone list for custom layouts.

Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Enter, Space · Full report

Import

tsx
import { FileUpload } from "@vjdesigns/vjdesigns-ui";

Importing only FileUpload adds about 19.2 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.

Examples

Dropzone

Drop files on the zone or browse. Accepted files are listed below with thumbnails and remove buttons.

Drop files here or browse

PNG, JPG or GIF, up to 5 MB each.

tsx
import { Field, FileUpload } from "@vjdesigns/vjdesigns-ui";

export function Dropzone() {
  return (
    <div style={{ width: "100%", maxWidth: "30rem" }}>
      <Field label="Project images">
        <FileUpload multiple accept="image/*" maxFiles={5} maxSize={5_000_000} hint="PNG, JPG or GIF, up to 5 MB each." />
      </Field>
    </div>
  );
}

Compact button

variant="button" is a compact alternative for forms with little room.

PDF or Word document.

tsx
import { Field, FileUpload } from "@vjdesigns/vjdesigns-ui";

export function CompactButton() {
  return (
    <div style={{ width: "100%", maxWidth: "30rem" }}>
      <Field label="Résumé">
        <FileUpload variant="button" accept=".pdf,.doc,.docx" hint="PDF or Word document." />
      </Field>
    </div>
  );
}

Accessibility

The drop zone is a labeled button, so it works with the keyboard as well as drag and drop. showRejections lists each rejected file with its reason, and every file in the list has a remove button named after that file.

Drop files here or browse

PDF, images up to 1.9 MB each.

PDF or images, up to 2 MB each.

tsx
import { Field, FileUpload } from "@vjdesigns/vjdesigns-ui";

export function Accessibility() {
  return (
    <div style={{ width: "100%", maxWidth: "30rem" }}>
      <Field label="Receipts" hint="PDF or images, up to 2 MB each.">
        <FileUpload multiple accept=".pdf,image/*" maxSize={2_000_000} showRejections />
      </Field>
    </div>
  );
}

Translated

The prompt, the browse button, file sizes, rejection reasons and the remove buttons' names come from the locale (Brazilian Portuguese here).

Solte os arquivos aqui ou procure

Imagens. Até 4 arquivos.

tsx
import { Field, FileUpload, LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ptBR from "@vjdesigns/vjdesigns-ui/locales/pt-BR";

export function Translated() {
  return (
    <LocaleProvider locale="pt-BR" messages={ptBR}>
      <div style={{ width: "100%", maxWidth: "30rem" }}>
        <Field label="Fotos do produto">
          <FileUpload multiple accept="image/*" maxFiles={4} />
        </Field>
      </div>
    </LocaleProvider>
  );
}

Right to left

The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.

Dropzone

أفلت الملفات هنا أو استعرض

PNG, JPG or GIF, up to 5 MB each.

tsx
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";

// Dropzone is the "Dropzone" example above.
<LocaleProvider locale="ar" messages={ar}>
  <Dropzone />
</LocaleProvider>

API reference

FileUpload

FileUpload props
PropTypeDefault
accept

File types to accept, as in the native attribute: "image/*", "image/png,.pdf". Also enforced on drop.

string—
multiple

Allow more than one file. Without it, a new file replaces the current one.

booleanfalse
maxFiles

Maximum number of accepted files in total (with multiple).

number—
maxSize

Maximum size of each file, in bytes.

number—
minSize

Minimum size of each file, in bytes.

number—
validator

Custom rule. Return a human-readable error message to reject the file, or null to accept it.

(file: File) => string | null—
value

Accepted files (controlled).

File[]—
defaultValue

Initially accepted files (uncontrolled).

File[]—
onValueChange

Called with the full list of accepted files whenever it changes (added or removed).

(files: File[]) => void—
onReject

Called with the files that failed validation in the latest selection or drop.

(rejections: FileRejection[]) => void—
onFileRemove

Called when a file is removed with its remove button (e.g. to cancel its upload).

(file: File) => void—
disabled

Disables the picker, drop target, and remove buttons. Inherits from a surrounding Field.

boolean—
invalid

Invalid state: danger border and aria-invalid on the Browse button. Inherits from a surrounding Field.

boolean—
name

Form field name. The native file input's files are kept in sync with the accepted list, so forms submit them.

string—
required

Native required on the file input. Inherits from a surrounding Field.

boolean—
size

sm: compact inline row. md: standard dropzone. lg: hero dropzone. Inherits from a surrounding Field.

"sm""md""lg""md"
variant

Presentation.

"dropzone""button""dropzone"
children

Replaces the prompt and hint inside the dropzone. A function receives { dragging, disabled, openPicker }. The Browse button is always rendered.

ReactNode | ((state: FileUploadRenderState) => ReactNode)—
prompt

Prompt text in the dropzone.

ReactNode"Drop files here or browse" ("Drop a file here or browse" without `multiple`)
hint

Hint under the prompt. Defaults to text built from accept, maxSize, and maxFiles (e.g. "PNG, JPG up to 5 MB each. Up to 3 files."). Pass null to hide. It is wired to the Browse button with aria-describedby.

ReactNode—
browseLabel

Label of the button that opens the picker.

string"Browse files" ("Upload files" for the `button` variant)
showList

Show the built-in file list.

booleantrue
showRejections

Show the latest rejections, with their reasons, under the picker.

booleantrue
showThumbnails

Show image thumbnails in the list.

booleantrue
getFileState

Per-file upload progress and status for the built-in list.

(file: File, index: number) => FileUploadFileState | undefined—
inputRef

Ref to the native <input type="file">. ref points at the root div.

Ref<HTMLInputElement>—
buttonRef

Ref to the Browse button.

Ref<HTMLButtonElement>—
id

id for the Browse button (the focusable control). Inside a Field, the Field's control id is used.

string—

Also accepts native <div> attributes, plus className, style and ref.

FileUpload.List

FileUpload.List props
PropTypeDefault
filesRequired

The files to show.

File[]—
onRemove

Called when a remove button is pressed. Omit to hide remove buttons.

(file: File, index: number) => void—
getFileState

Per-file upload progress and status.

(file: File, index: number) => FileUploadFileState | undefined—
showThumbnails

Show image thumbnails (object URLs, revoked on removal and unmount).

booleantrue
disabled

Disables the remove buttons.

booleanfalse
aria-label

Accessible name of the list.

string"Selected files"
removeLabel

Builds each remove button's accessible name.

(fileName: string) => string(name) => `Remove ${name}`
focusFallback

Element to focus after the last file is removed (for example the Browse button). Otherwise focus moves to the next item's remove button, or the previous one when the last item was removed.

() => HTMLElement | null | undefined—
size

Row density.

"sm""md""lg""md"

Also accepts native <ul> attributes, plus className, style and ref.

See what changed in each version in the Changelog.

Accessibility report

FileUpload targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.

axe-core audit (live)

Running accessibility audit

Checking the examples above…

Lighthouse audit

Light mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Dark mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.

Built-in behavior

Keyboard

Keyboard
KeyAction
EnterSpaceOn the browse button: opens the file chooser. Files can also be dropped on the zone.

Roles and states

Roles and states
ElementRoleStates and properties
Drop zonegrouparia-labelledby → label
Browse buttonbuttonaria-describedby → accepted types and limits
File list remove buttonsbuttonaria-label ("Remove …")
Live regionstatusAnnounces added, rejected and removed files

Manual checks

Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.

Manual accessibility checks
CheckWhat to testWCAG 2.2
KeyboardEvery action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck.2.1.1 (A), 2.1.2 (A)
FocusFocus moves in a logical order, is always visible, and isn't hidden behind sticky headers.2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA)
Screen readersNames, roles and states are announced correctly, and status changes are announced without moving focus.1.3.1 (A), 4.1.2 (A), 4.1.3 (AA)
ColorMeaning never depends on color alone; your own colors meet contrast in both modes.1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA)
Zoom and reflowAt 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed.1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA)
Pointer targetsClick and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap.2.5.8 (AA), 2.5.5 (AAA)
MotionAnimations respect the reduced-motion setting.2.3.3 (AAA)