The File Button component for Retool Apps
A button to select single or multiple files.
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 |
Examples
["image/*", "pdf", "doc"]
appendNewSelection
Whether to append additional files to the value.
Type | boolean |
Configurability | Inspector |
disabled
Whether input, interaction, selection, or triggering is disabled.
Type | boolean |
Format | True/False |
Configurability | Inspector > Interaction > Disabled |
Default |
|
Examples
true
events
A list of configured event handlers that trigger actions or queries.
Type | array |
Array values | object |
Configurability | Inspector > Interaction > Event handlers |
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 |
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 |
type
The type of action to perform.
Type | string | ||||||||||||||
Configurability | Inspector > Interaction > Event handlers > Edit event handler > Action | ||||||||||||||
Allowed Values |
|
files
A list of metadata from the selected files.
Type | array |
Array values | object |
Configurability | Read-only |
Array Object Properties
lastModified
The last modified date as a timestamp.
Type | number |
Format | Timestamp |
Configurability | Read-only |
Examples
1617024000000
iconAfter
The suffix icon to display.
Type | string |
Format | Icon Key |
Configurability | Inspector > Content > Add-ons > Suffix icon |
Default |
|
Examples
/icon:bold/shopping-gift
iconBefore
The prefix icon to display.
Type | string |
Format | Icon Key |
Configurability | Inspector > Content > Add-ons > Prefix icon |
Default |
|
Examples
/icon:bold/shopping-gift
isPublic
Whether to make the file public when uploading with Retool Storage.
Type | boolean |
Configurability | Inspector |
loaderPosition
The position of the loading indicator if loading
is true
.
Type | string | ||||||||||
Configurability | Inspector > Interaction > Loader position | ||||||||||
Allowed Values |
| ||||||||||
Default |
|
loading
Whether to display a loading indicator.
Type | boolean |
Format | True/False |
Configurability | Inspector > Interaction > Loading |
Default |
|
Examples
true
selectionType
The type of file selection.
Type | string | ||||||||
Configurability | Inspector | ||||||||
Allowed Values |
|
shouldOverwriteOnNameCollision
Whether to replace a file with the same name when uploading with Retool Storage.
Type | boolean |
Configurability | Inspector |
styleVariant
The style variant to use.
Type | string | ||||||
Format | Plain Text | ||||||
Configurability | Inspector > Appearance > Variant | ||||||
Allowed Values |
| ||||||
Default |
|
Examples
solid
text
The primary text content.
Type | string |
Format | Plain Text |
Configurability | Inspector > Content > Add-ons > Text |
Examples
Submit
uploadToRetoolStorage
Whether to upload a file to Retool Storage.
Type | boolean |
Configurability | Inspector |
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
fileButton.clearValidation()
Clear the validation message from the input field.
fileButton.clearValidation()
Examples
Clear the validation message from fileButton
.
fileButton.clearValidation();
fileButton.clearValue()
Clear the current values.
fileButton.clearValue()
Examples
Clear the current value of fileButton
.
fileButton.clearValue();
fileButton.focus()
Set focus on the input field.
fileButton.focus()
Examples
Set focus on fileButton
.
fileButton.focus();
fileButton.resetValue()
Reset the current value to the default value.
fileButton.resetValue()
Examples
Reset the current value of fileButton
.
fileButton.resetValue();
fileButton.scrollIntoView()
Scrolls the canvas or parent container so that the selected component appears in the visible area.
fileButton.scrollIntoView(options)
Parameters
Object Properties
behavior
The scroll behavior.
Type | string | ||||||
Allowed Values |
|
block
The scroll position relative to the component.
Type | string | ||||||||||
Allowed Values |
|
Examples
Scroll the minimum amount to immediately bring fileButton
into view.
fileButton.scrollIntoView({behavior: 'auto', block: 'nearest'});
fileButton.setDisabled()
Set the disabled
value to toggle whether the input field is disabled. Defaults to true
without a parameter.
fileButton.setDisabled(disabled)
Parameters
disabled
Whether input, interaction, selection, or triggering is disabled.
Type | boolean |
Format | True/False |
Default |
|
Examples
true
Examples
Disable fileButton
.
fileButton.setDisabled(true);
Enable fileButton
.
fileButton.setDisabled(false);
fileButton.setHidden()
Set the hidden
value to toggle whether the component is visible. Defaults to true
without a parameter.
fileButton.setHidden(hidden)
Parameters
Examples
true
Examples
Hide fileButton
.
fileButton.setHidden(true);
Unhide fileButton
.
fileButton.setHidden(false);
fileButton.validate()
Validates the value of the input field.
fileButton.validate()
Examples
Validate the value of fileButton
.
fileButton.validate();
Events
Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.
Event | Description |
---|---|
Change | The value is changed. |
Parse | Data is parsed. |