Skip to main content

Modules

A module is a type of app you can build and embed within other apps. Modules enable you to reuse components and code in multiple apps, and modules can pass data to and from the parent app. This can help reduce app maintenance as you only need to update a module; any parent apps immediately reflect the changes.

Refer to the modules guide for more information about creating and using modules.

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.

heightType

Whether the height automatically adjusts to fit content or is a fixed size.

Type string
Format Plain Text
Configurability Inspector > Spacing > Height
Allowed Values
ValueDescription
fixed

Fixed height.

auto

Expand to fit content.

Defaultfixed

id

The unique identifier (name).

Type string
Format Plain Text
Configurability Inspector
Defaultmodules1
Examples
query1
button1

name

The name of the module.

Type string
Configurability Read-only
Defaultnull

overflowType

The overflow behavior when the contents exceed the height.

Type string
Configurability Inspector
Allowed Values
ValueDescription
scroll

Display a scrollbar.

pagination
Defaultnull

pageUuid

The unique identifier for the page.

Type string
Configurability Read-only
Defaultnull

showFetchingIndicator

Whether to show a loading indicator when the module's contents are being fetched.

Type boolean
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.

modules.scrollIntoView()

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

Definition
modules.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 modules into view.

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

modules.setOutput()

Set the module output.

Definition
modules.setOutput(outputName, value)
Parameters

outputName

The name of the module output to set.

Type string

value

The value.

Type string | number | boolean | object | array