File Dropzone

A drag-and-drop area to select and upload files. It supports file type restrictions, multiple file or directory selection, and can perform validation of field requirement, minimum or maximum size, and custom rules.

File Dropzone can attempt to parse text-based files, such as JSON, CSV, and Excel spreadsheets. The maximum size for uploaded files is 40MB.

Properties

Available properties for File Dropzone with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read information about components.

NameTypeDescriptionvaluestring[] | { name: string; type: string; sizeBytes: number; base64Data: string; }[]

The selected files as Retool file objects. For legacy components, the selected files are base64 encoded strings.

acceptstring[]

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

appendNewSelectionboolean

When true, new file selections will be appended to the current file list instead of replacing it.

disabledboolean

Whether user input, interaction, or selection is disabled.

files{ lastModified: number; name: string; size: number; type: string; }[]

New components no longer have this property. A list of metadata from the selected files. Includes name, type, size, and lastModified.

formDataKeystring

The key used by a Form component to assign default values to input fields using form.initialData, and to construct the form.data property.

hiddenboolean

Whether the component is visible.

hideValidationMessageboolean

Whether to hide the validation message if the invalid is true.

iconBeforeIconKey

The icon to display before the primary content.

invalidboolean

Whether the current value has failed any validation rules.

isPublicboolean

When true, the file will be accessible through URL from outside of Retool. When false, the file will only be accessible within Retool.

labelstring

The text to display as a label for the input field.

labelAlign'left' | 'right'

The horizontal alignment of the label.

labelCaptionstring

The additional text to display with the label.

labelPosition'left' | 'top'

The position of the label relative to the input field.

labelWidthnumber

The label width, in the unit specified in labelWidthUnit.

labelWidthUnit'%' | 'px' | 'col'

The specified units for labelWidth.

labelWrapboolean

Whether the label can wrap to multiple lines.

loadingboolean

Whether to display a loading indicator.

maintainSpaceWhenHiddenboolean

Whether the component takes up space on the canvas if hidden is true.

marginstring

The amount of margin to render outside of the component.

maxCountnumber | null

The maximum number of items to allow.

maxSizestring

The maximum file size to allow, with optional size unit. Defaults to bytes if no unit specified.

minCountnumber | null

The minimum number of items to allow.

minSizestring

The minimum file size to allow, with optional size unit. Defaults to bytes if no unit specified.

parseFilesboolean

Whether to parse the selected files. Parsing is supported for JSON, CSV, TSV, Excel, and text files.

parsedValueunknown[]

The data parsed from the selected files if parseFiles is true.

parsingboolean

Whether selected files are currently being read or parsed.

placeholderstring

The text to display in the input field when empty.

requiredboolean

Whether the input is required for validation.

selectionType'single' | 'multiple' | 'directory'

Whether to allow selection of single or multiple files, or a directory of files.

shouldOverwriteOnNameCollisionboolean

When true, the file will be overwritten if a file with the same name already exists. If false and a file with the same name already exists, the file will be renamed to include a number at the end to avoid collissions E.g: example (1).txt

showInEditorboolean

Whether the component remains visible in the editor if hidden is true.

tooltipTextstring

The text to display in a tooltip on hover or focus.

uploadToRetoolStorageboolean

When true, files will be uploaded to Retool Storage.

validationMessagestring

The validation message to display if the input is invalid.

Events

Events are triggered by user interactions with File Dropzone. Use event handling to trigger queries or other actions in response to events.

NameDescriptionChange

A user changes the current value.

Parse

An uploaded file is parsed.

Methods

Methods for interacting with File Dropzone. You can write JavaScript almost anywhere in Retool and use methods to manipulate data or components.

NameDescriptionclearValue()

Clear the current value.

scrollIntoView(options: any)

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

validate()

Validates the value of the input field.

clearValidation()

Clear the validation message from the input field.

setHidden(hidden: boolean)

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

setDisabled(disabled: boolean)

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

resetValue()

Reset value to the default value.

focus()

Set focus on the input field.

blur()

Removes focus on the input field.

Related components