Skip to main content

The Image component for Retool Mobile

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.

cornerType​

The corner style to use.

Type string
Configurability Inspector
Allowed Values
ValueDescription
square

Square corners.

round

Rounded corners.

circle

Circular corners.

Defaultnull

dbBlobId​

Self-hosted Retool deployments only. The ID of the uploaded image when srcType is dbBlobId.

Type string
Configurability Read-only
Defaultnull

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


hidden​

Whether this object is hidden from view.

Type boolean
Format True/False
Configurability Inspector > Appearance > Hidden
Defaultfalse
Examples
falsetrue

mode​

How to render images to fit.

Type string
Configurability Inspector
Allowed Values
ValueDescription
cover

Scale the image to fit the area while preserving the aspect ratio.

center

Center the image.

stretch

Resize the image to the same dimensions as the area.

contain

Scale and clip the image to fit the area while preserving the aspect ratio.

Defaultnull

ratio​

The ratio of width-to-height.

Type string
Configurability Inspector
Allowed Values
ValueDescription
2

2:1 ratio.

1.3333333333333333

4:3 ratio.

1

1:1 ratio.

0.75

3:4 ratio.

Defaultnull

retoolFileObject​

The file's data when using a file not stored in Retool Storage.

Type object
Configurability Read-only
Defaultnull
Object Properties

base64Data​

The base64 encoded data of the file.

Type string
Configurability Read-only
Defaultnull

sizeBytes​

The size of the file in bytes.

Type number
Configurability Read-only
Defaultnull

type​

The MIME type.

Type string
Configurability Read-only
Defaultnull

name​

The file name.

Type string
Configurability Read-only
Defaultnull

Examples
false{
"name": "sample.pdf",
"type": "application/pdf",
"sizeBytes": 10523,
"base64Data": "JVBERi0xLjQKJeLjz9...G"
}

retoolStorageDynamicInput​

Whether retoolStorageFileId is set dynamically.

Type string
Configurability Read-only
Defaultnull

retoolStorageFileId​

The unique identifier for a file in Retool Storage.

Type string
FormatUUID
Configurability Inspector > Content > File input
Defaultnull

src​

The data source.

Type string
Formatstring
Configurability Inspector
Defaultnull
Examples
falsehttps://upload.wikimedia.org/wikipedia/commons/1/14/Marspathfinder.pdf

srcType​

The source type.

Type string
Configurability Inspector
Allowed Values
ValueDescription
src

URL.

retoolStorageFileId

Retool Storage file.

retoolFileObject

Retool file object.

dbBlobId

Database blob.

storageBlobId

Storage blob.

Defaultnull

storageBlobId​

The ID of the uploaded image when srcType is storageBlobId.

Type string
Format Blob URI
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.

image.setHidden()​

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

Definition
image.setHidden(hidden)
Parameters

hidden​

Whether this object is hidden from view.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Hide image.

image.setHidden(true);

Unhide image.

image.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
ClickAn item is clicked or pressed.