FileUpload
FileUpload is a drag-and-drop file region. It wraps a hidden native file input and hands you a render prop with the current drag state and a function to open the file picker.
What it is
A single component with a render-prop child. It owns a hidden <input type="file"> and a
drop-zone wrapper that tracks drag events. Your render function receives isDragging — true while
a file is dragged over the zone — and openPicker, which opens the native file dialog. Files
arrive through onFiles, whether dropped or chosen.
Because the input is real, the file dialog, the accept filter, and multiple are all the
platform's, not a reimplementation.
Install
API
FileUpload
stablefunction FileUpload(props: FileUploadProps): JSX.Element
Render prop for the drop zone. `isDragging` is true during a drag-over; `openPicker` opens the native file dialog.
Called with the selected files — whether dropped or chosen through the dialog.
The native `accept` filter, e.g. `"image/*"` or `".pdf,.docx"`.
Allow selecting more than one file.
Ignore drops and picker opens.
Inline style for the drop-zone wrapper.
Accessibility
Drag-and-drop is a pointer-only gesture — a keyboard or screen-reader user cannot drag a file.
openPicker is the path that keeps FileUpload usable: wire it to a real <button> inside your
render prop, so the file dialog can be opened from the keyboard. The drop zone is an enhancement
on top of that button, not a replacement for it.
Treat the drag zone as visual sugar. The button labelled "Choose files" — or similar — is the control that must always work.
Examples
A drop zone with a fallback button: