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>| Prop | Type | Default | Description |
|---|---|---|---|
| accept | Accept | AcceptGroup[] | — | |
| min | number | — | |
| max | number | — | |
| max | number | — | |
| prevent | boolean | — | |
| no | boolean | — | |
| no | boolean | — | |
| no | boolean | — | 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 |
| disabled | boolean | — | |
| on | — | ||
| on | — | ||
| on | — | ||
| get | — | ||
| on | — | ||
| on | — | ||
| on | — | ||
| 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. | |
| get | — | 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. | |
| use | boolean | — | |
| auto | boolean | — | |
| files | readonly File[] | — | The accepted files (controlled). |
| default | readonly File[] | — | The accepted files at first (uncontrolled). |
| on | — | Runs when a drop, a pick, a paste, or a remove changes the list. | |
| name | string | — | The form field name: a normal form submit sends the files under it. |
| required | boolean | — | The form needs at least one file (native validation on submit). |
| read | boolean | — | 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. |
| invalid | boolean | — | Shows the area as invalid (a red edge), for an error that the app sets. |
| no | boolean | — | A click on the area does not open the dialog; only the trigger does. Default false. |
| locale | LocalesArgument | — | The locale of the sizes in the messages and the file list. |
| directory | boolean | — | 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. |
| actions | — | Gets open (the file dialog, for a menu item or a shortcut, in the press itself), clear (empties the list), and clearRejections. | |
| class | string | — | |
| children | ReactNode | — | |
| 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>| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
FileInputPreview
<img>| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | 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>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| class | string | — | |||||
| placeholder | string | — | The text when the list is empty. Default the placeholder word of the labels. | ||||
| value | "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 | |||||||
| focusable | boolean | false | Whether 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>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| class | string | — | |||||
| rounded | "default""full" | — | |||||
From Base UIButtonBase UI docs | |||||||
| focusable | boolean | false | Whether 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>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
FileInputRetry
<button>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| class | string | — | |||||
| rounded | "default""full" | — | |||||
From Base UIButtonBase UI docs | |||||||
| focusable | boolean | false | Whether 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>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| class | string | — | |||||
| rounded | "default""full" | — | |||||
From Base UIButtonBase UI docs | |||||||
| focusable | boolean | false | Whether 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>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| class | string | — | |||||
| rounded | "default""full" | — | |||||
| variant | "dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary" | "secondary" | |||||
| size | "xs" | "xs" | |||||
From Base UIButtonBase UI docs | |||||||
| focusable | boolean | false | Whether 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. | ||||
| EnterorSpace | On FileInputValue or FileInputTrigger: opens the file picker. |
|---|---|
| ⌘VorCtrlV | Focus on a part of the field: pastes files. |
Built with
Installs with File Input
- Components
- Button,Circular Progress,Dropzone,File Icon,Input Group,Popover









