Skip to main content

The Button component for Retool Mobile

A button to trigger actions when clicked.

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.

disabled

Whether input, interaction, selection, or triggering is disabled.

Type boolean
Format True/False
Configurability Inspector > Interaction > Disabled
Defaultfalse
Examples
true

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
true

Examples
/icon:bold/shopping-gift

Examples
/icon:bold/shopping-gift

loading

Whether to display a loading indicator.

Type boolean
Format True/False
Configurability Inspector > Interaction > Loading
Defaultfalse
Examples
true

size

The size.

Type string
Configurability Inspector
Allowed Values
ValueDescription
default

The default size.

small

The smallest size.

Defaultnull

submit

Whether to submit using the submitTargetId property when clicked.

Type boolean
Format True/False
Configurability Inspector > Interaction > Type
Defaultfalse
Examples
true

submitTargetId

The form to submit when the submit property is true.

Type string
Format Retool object name
Configurability Read-only
Defaultnull
Examples
form1

Examples
Submit

type

The type of content or action to perform.

Type string
Configurability Inspector
Defaultnull

width

The width.

Type string
Format Integer
Configurability Inspector
Allowed Values
ValueDescription
full

Full width.

fixed

Fixed width.

Defaultnull
Examples
1280

Methods

JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.

button.setDisabled()

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

Definition
button.setDisabled(disabled)
Parameters

disabled

Whether input, interaction, selection, or triggering is disabled.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Disable button.

button.setDisabled(true);

Enable button.

button.setDisabled(false);

button.setHidden()

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

Definition
button.setHidden(hidden)
Parameters

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Hide button.

button.setHidden(true);

Unhide button.

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