Skip to content

File Input

Free

A form field that holds files: it looks like an Input, opens the file picker, takes a drop, and checks the picked files with the Dropzone rules.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 16, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Compose the field box with its parts inside FileInput. The checks are the Dropzone checks, so DropzoneRejections shows why a file did not fit.

invoice-field.tsx

FileInput

<div>
PropTypeDefaultDescription
acceptAccept | AcceptGroup[]—
minSizenumber—
maxSizenumber—
maxFilesnumber—
preventDropOnDocumentboolean—
noDragboolean—
noDragEventsBubblingboolean—
noPasteboolean—If true, disables paste-to-upload. By default, when the dropzone (or a focused child) receives a paste that carries files - e.g. a screenshot pasted with Ctrl/Cmd+V - those files go through the same accept/size/validator checks and onDrop callbacks as a drop. Pastes with no files (plain text, etc.) are ignored and left untouched. See https://github.com/react-dropzone/react-dropzone/issues/1210
disabledboolean—
onDrop—
onDropAccepted—
onDropRejected—
getFilesFromEvent—
onFileDialogCancel—
onFileDialogOpen—
onError—
validator—Custom validation, run once per file on drop/selection. Return null to accept the file, or a FileError (or array of them) to reject it. May be async (return a Promise) to support checks that can't run synchronously - e.g. reading image dimensions, inspecting file contents, or calling an external service. While an async validator is pending, DropzoneState.isProcessing is true, and onDrop/onDropAccepted/onDropRejected fire only once it settles. If the validator throws or rejects, onError is called and the drop is discarded. Note: the validator never runs during a drag (a DataTransferItem has no name/size), so a validator-configured dropzone is isDragUnknown until drop.
getErrorMessage—Override the message of any rejection error (built-in or custom). Called once per error; receives the error and the file it belongs to and returns the message to use. Return error.message for codes you don't want to change. Useful for localizing error messages.
useFsAccessApiboolean—
autoFocusboolean—
filesreadonly File[]—The accepted files (controlled).
defaultFilesreadonly File[]—The accepted files at first (uncontrolled).
onFilesChange—Runs when a drop, a pick, a paste, or a remove changes the list.
namestring—The form field name: a normal form submit sends the files under it.
requiredboolean—The form needs at least one file (native validation on submit).
readOnlyboolean—The list shows, but nothing adds files: no dialog (also not from a label click), no drop, and no paste; the trigger is off. Render no remove buttons then. Default false.
invalidboolean—Shows the area as invalid (a red edge), for an error that the app sets.
noClickboolean—A click on the area does not open the dialog; only the trigger does. Default false.
localeLocalesArgument—The locale of the sizes in the messages and the file list.
directoryboolean—The dialog picks a folder (webkitdirectory), and every file in it is added. A dropped folder always works. Not with useFsAccessApi: that picker cannot choose folders.
capture"environment" | "user" | boolean—The camera on a phone (capture of the file input): "environment" (back) or "user" (front). Android opens only the camera then. For a choice of camera or gallery, use two Dropzones, each with its own trigger.
actionsRef—Gets open (the file dialog, for a menu item or a shortcut, in the press itself), clear (empties the list), and clearRejections.
classNamestring—
childrenReactNode—
rounded"default""full""default"
size"default""lg""sm""default"28, 32, or 36px: the field sizes of controlVariants that the field has.
uploads—The list and its uploads (useFileUploads): the field shows the files of uploads, sends a pick to uploads.sync, and shows the progress, the done check, and Retry.
labels—Every word: the field words (FileInputLabels) and the Dropzone words (DropzoneLabels, the messages of a wrong file) in one object. Keep the object stable.
...props<div> attributes—Every other attribute goes to the <div>.

FileInputControl

<div>
PropTypeDefaultDescription
childrenReactNode—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

FileInputPreview

<img>
PropTypeDefaultDescription
childrenReactNode—The icon of a field with no picture. Default a paperclip.
...props<img> attributes—Every other attribute goes to the <img>, with a ref.

FileInputValue

<button>
PropTypeDefaultDescription
classNamestring—
placeholderstring—The text when the list is empty. Default the placeholder word of the labels.
valueDisplay"count""first""first"How many files read: first ("receipt.jpg +2", default) or count ("3 files"). One file always shows its name.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

FileInputMore

<button>
PropTypeDefaultDescription
classNamestring—
rounded"default""full"—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

FileInputProgress

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

FileInputRetry

<button>
PropTypeDefaultDescription
classNamestring—
rounded"default""full"—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

FileInputClear

<button>
PropTypeDefaultDescription
classNamestring—
rounded"default""full"—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

FileInputTrigger

<button>
PropTypeDefaultDescription
classNamestring—
rounded"default""full"—
variant"dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary""secondary"
size"xs""xs"
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.
  • Use it in a form next to text fields, where a large drop area takes too much space.
  • Use multiple and FileInputMore to show many files in one row, with a list in a popover.
  • Pass uploads from useFileUploads to show the percent, the done check, and Retry in the field.
  • Put it in a Base UI Field to get the label, the help, required, and the error.
  • For a large drop area with sources and a file list, use a Dropzone.
  • For a button that only gives the files to your code, use a File Trigger.
EnterorSpaceOn FileInputValue or FileInputTrigger: opens the file picker.
⌘VorCtrlVFocus on a part of the field: pastes files.

FileInputValue is a button. Its name is the file name, or the placeholder when the field is empty.

In a Base UI Field, the label names the value button, and the help and the error describe it.

A full list keeps the value button in the tab order with aria-disabled.

An invalid field, or a failed upload, sets aria-invalid on the value button.

Upload bar
indicator · 200ms · ease-panel (0.2, 0.4, 0.2, 1) · the 2px bar on the bottom edge grows with the bytes
File list
popup · 150ms · ease-panel (0.2, 0.4, 0.2, 1) · the "+2" popover fades in and scales from 95%
  1. AddedFile Input, with Button, Circular Progress, Dropzone, File Icon, Input Group, Popover.
Open the release