Skip to main content

The File Input component for classic apps

Classic apps

You're viewing documentation for classic apps, which use Retool's original app editor. The new app builder is the recommended way to build apps and where Retool focuses new development.

Refer to the File inputs guide for more information on how to use this component.

Properties​

All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.

accept​

A list of file extensions or file-type specifiers to accept.

Type array
Array values string
Configurability Inspector > content > File types
Defaultnull
Examples
false["image/*", "pdf", "doc"]

appendNewSelection​

Whether to append additional files to the value.

Type boolean
Configurability Inspector
Defaultnull

disabled​

Whether input, interaction, selection, or triggering is disabled.

Type boolean
Format True/False
Configurability Inspector > Interaction > Disabled
Defaultfalse
Examples
falsetrue

events​

A list of configured event handlers that trigger actions or queries.

Type array
Array values object
Configurability Inspector > Interaction > Event handlers
Defaultnull
Array Object Properties

event​

The event that triggers the action. Refer to the events section for details of available events for this object.

Type string
Configurability Inspector > Interaction > Event handlers > Event
Defaultnull

method​

The JavaScript method to perform when type is datasource, widget, state, or localStorage.

Type string
Configurability Inspector > Interaction > Event handlers > Edit event handler > Run script actions
Defaultnull

type​

The type of action to perform.

Type string
Configurability Inspector > Interaction > Event handlers > Edit event handler > Action
Allowed Values
ValueDescription
datasource

Control query.

widget

Control component.

script

Run script.

state

Set variable.

localStorage

Set localStorage.

util

Perform utility action (e.g., Open URL or Confetti).

Defaultnull


files​

A list of metadata from the selected files.

Type array
Array values object
Configurability Read-only
Defaultnull
Array Object Properties

lastModified​

The last modified date as a timestamp.

Type number
Format Timestamp
Configurability Read-only
Defaultnull
Examples
false1617024000000

name​

The file name with extension.

Type string
Configurability Read-only
Defaultnull

retoolStorageId​

The file ID if uploaded to Retool Storage.

Type string
Configurability Read-only
Defaultnull

size​

The file size, in bytes.

Type string
Configurability Read-only
Defaultnull

type​

The MIME type.

Type string
Configurability Read-only
Defaultnull

uploading​

Whether the file is uploading.

Type boolean
Configurability Read-only
Defaultnull


Examples
false/icon:bold/shopping-gift

Examples
false/icon:bold/shopping-gift

isPublic​

Whether to make the file public when uploading with Retool Storage.

Type boolean
Configurability Inspector
Defaultnull

labelPosition​

The position of the label relative to the input field or value.

Type string
Format Plain Text
Configurability Inspector > Content > Add-ons > Label > Position
Allowed Values
ValueUI OptionDescription
topTop

Above the input field or value.

leftLeft

Left of the input field or value.

Defaultleft
Examples
falsetop

loading​

Whether to display a loading indicator.

Type boolean
Format True/False
Configurability Inspector > Interaction > Loading
Defaultfalse
Examples
falsetrue

maxCount​

The maximum number of items to allow.

Type number
Configurability Inspector
Defaultnull

maxSize​

The maximum file size allowed.

Type number
Configurability Inspector
Defaultnull

minCount​

The minimum number of items to allow.

Type number
Configurability Inspector
Defaultnull

minSize​

The minimum file size allowed.

Type number
Configurability Inspector
Defaultnull

parsedValue​

The parsed value of the input.

Type array
Array values string
Configurability Read-only
Defaultnull

parseFiles​

Whether to parse plain-text content.

Type boolean
Configurability Inspector
Defaultnull

parsing​

Whether content is being parsed.

Type boolean
Configurability Read-only
Defaultnull

placeholder​

The text to display within the input field when there is no value.

Type string
Formatstring
Configurability Inspector > Content > Placeholder
DefaultEnter a value
Examples
falseEnter a value

selectionType​

The type of file selection.

Type string
Configurability Inspector
Allowed Values
ValueDescription
single

Select a single file.

multiple

Select multiple files.

directory

Select a directory of files.

Defaultnull

shouldOverwriteOnNameCollision​

Whether to replace a file with the same name when uploading with Retool Storage.

Type boolean
Configurability Inspector
Defaultnull

showClear​

Whether to display a button to clear the value of the input field.

Type boolean
Format True/False
Configurability Inspector > Appearance > Show clear button
Defaultfalse
Examples
falsetrue

style​

Custom style options.

Type object
Configurability Inspector > Appearance > style
Defaultnull

Examples
falseUSD
falsepx
false@example.com

Examples
false$
falseEmail address
falseSKU

uploadToRetoolStorage​

Whether to upload a file to Retool Storage.

Type boolean
Configurability Inspector
Defaultnull

value​

A list of uploaded files.

Type array
Configurability Read-only
Defaultnull

Methods​

JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.

fileInput.clearValidation()​

Clear the validation message from the input field.

Definition
fileInput.clearValidation()
Examples

Clear the validation message from fileInput.

fileInput.clearValidation();

fileInput.clearValue()​

Clear the current values.

Definition
fileInput.clearValue()
Examples

Clear the current value of fileInput.

fileInput.clearValue();

fileInput.focus()​

Set focus on the component.

Definition
fileInput.focus()
Examples

Set focus on fileInput.

fileInput.focus();

fileInput.resetValue()​

Reset the current value to the default value.

Definition
fileInput.resetValue()
Examples

Reset the current value of fileInput.

fileInput.resetValue();

fileInput.scrollIntoView()​

Scrolls the canvas or parent container so that the selected component appears in the visible area.

Definition
fileInput.scrollIntoView(options)
Parameters

options​

The scroll options.

Type object
Object Properties

behavior​

The scroll behavior.

Type string
Allowed Values
ValueDescription
auto

Scroll immediately to the specified position.

smooth

Scroll gradually to the specified position.


block​

The scroll position relative to the component.

Type string
Allowed Values
ValueDescription
nearest

Scrolls only the minimum amount required for the component to appear in the visible area. Scrolling does not occur if the component is already in view.

start

Scrolls to position the component at the top of the visible area.

center

Scrolls to position the component in the middle of the visible area.

end

Scrolls to position the component at the bottom of the visible area.



Examples

Scroll the minimum amount to immediately bring fileInput into view.

fileInput.scrollIntoView({behavior: 'auto', block: 'nearest'});

fileInput.setDisabled()​

Set the disabled value to toggle whether the input field is disabled. Defaults to true without a parameter.

Definition
fileInput.setDisabled(disabled)
Parameters

disabled​

Whether input, interaction, selection, or triggering is disabled.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Disable fileInput.

fileInput.setDisabled(true);

Enable fileInput.

fileInput.setDisabled(false);

fileInput.setHidden()​

Set the hidden value to toggle whether the component is visible. Defaults to true without a parameter.

Definition
fileInput.setHidden(hidden)
Parameters

hidden​

Whether this object is hidden from view.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Hide fileInput.

fileInput.setHidden(true);

Unhide fileInput.

fileInput.setHidden(false);

Events​

Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.

EventDescription
ChangeThe value is changed.
ParseData is parsed.