Skip to Content
Forms & Inputs@hacline/ui/file-input

FileInput

Select, drop, or paste files and display the selected items.

Usage

<FileInputList /> renders a ready-to-use file card with image thumbnails, semantic file icons, file size, and a remove button by default. Format validation errors cleanly with formatFileRejection.

Drop files here or paste from clipboard

Images, PDF, or Markdown (up to 4 files)

Async Upload Queue (useFileUpload)

Pair FileInput with useFileUpload to manage concurrent uploads, per-file progress bars, cancellation via AbortController, and retries. Connect onValueChange={uploader.syncFiles} to keep the queue automatically synchronized.

Drop files or load samples to test concurrent uploads

Reading Files in a Form

Set name and required on the component. On form submission, read the File objects directly from FormData.

Supports TXT or Markdown

Parts

PartDescriptionExtended Props
FileInputDropzone
Takes dropped and pasted files. Put the trigger inside it, which is how keyboard and screen reader users choose files.
variant
FileInputItem
One file. Its render state has the file, for its name, size and preview. Arrow keys move between items, and Backspace or Delete removes the focused one.—
FileInputItemPreview
Renders an automatic image thumbnail (with safe ObjectURL cleanup) or a semantic file-type icon for non-image files.
filesizefallback
FileInputItemName
Displays the file name (or folder-relative path when showPath is enabled) with single-line truncation.
fileshowPath
FileInputItemSize
Displays the formatted file size using formatFileSize with tabular numerals.
filelocale
FileInputItemRemove
Removes its item's file, or the file it's given. It's named "Remove <file name>" unless you name it.—
FileInputList
The files, as a list. Its children render once for each file, so put a FileInputItem in it.
variant
FileInputTrigger
Opens the file picker. Inside a Field, the field's label names it with the button's own text. Outside the file input, it connects through controller.—
formatFileRejectionhelper
Helper that formats a FileRejection from onReject into a human-readable validation message.—
useFileUploadhook
Headless React hook managing concurrent async uploads, per-file progress, AbortController cancellation, and retries.—

Props

Prop

Type

View parts and state attributes in UI SDK.