Skip to main content

The Image component for Retool Mobile

A content area to display an image.

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.


dbBlobId

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

Type string
Configurability Read-only

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
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).



hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Configurability Inspector > Appearance > Hidden
Default
false
Examples
true

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.


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.


retoolFileObject

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

Type object
Configurability Read-only
Object Properties

base64Data

The base64 encoded data of the file.

Type string
Configurability Read-only

sizeBytes

The size of the file in bytes.

Type number
Configurability Read-only

type

The MIME type.

Type string
Configurability Read-only

name

The file name.

Type string
Configurability Read-only

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

retoolStorageDynamicInput

Whether retoolStorageFileId is set dynamically.

Type string
Configurability Read-only

retoolStorageFileId

The unique identifier for a file in Retool Storage.

Type string
FormatUUID
Configurability Inspector > Content > File input

src

The data source.

Type string
Formatstring
Configurability Inspector
Examples
https://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.


storageBlobId

The ID of the uploaded image when srcType is storageBlobId.

Type string
Format Blob URI
Configurability Read-only

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.