Skip to main content

The Segmented Control component for Retool Mobile

An input field to select an option from a list.

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
Mutability
ControlUsage
Retool UI Inspector > Interaction > Disabled
MethodsetDisabled()
Default
false
Examples
true

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Appearance > Hidden
MethodsetHidden()
Default
false
Examples
true

label

The text label to display.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector > Content > Add-ons > Label > Label
Default
null
Examples
"Label"

labelCaption

The additional text to display with the label.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector > Content > Add-ons > Label > Caption

labels

A list of labels for each item. Falls back to the corresponding value if no label is provided.

Type array
Array values string
Mutability Read-only
Default
[]
Examples
["Label 1", "Label 2", "Label 3"]

value

The current or default value.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector > Content > Default value
MethodsetValue()
Default
null
Examples
Hello world!

values

A list of possible values from which to select.

Type array
Mutability 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.

segmentedControl.clearValue()

Clear the current values.

Definition
segmentedControl.clearValue()
Examples

Clear the current value of segmentedControl.

segmentedControl.clearValue();

segmentedControl.focus()

Set focus on the input field.

Definition
segmentedControl.focus()
Examples

Set focus on segmentedControl.

segmentedControl.focus();

segmentedControl.resetValue()

Reset the current value to the default value.

Definition
segmentedControl.resetValue()
Examples

Reset the current value of segmentedControl.

segmentedControl.resetValue();

segmentedControl.setDisabled()

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

Definition
segmentedControl.setDisabled(disabled)
Parameters

disabled

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

Type boolean
Format True/False
Default
false
Examples
true

Examples

Disable segmentedControl.

segmentedControl.setDisabled(true);

Enable segmentedControl.

segmentedControl.setDisabled(false);

segmentedControl.setHidden()

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

Definition
segmentedControl.setHidden(hidden)
Parameters

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Hide segmentedControl.

segmentedControl.setHidden(true);

Unhide segmentedControl.

segmentedControl.setHidden(false);

segmentedControl.setValue()

Set the current value.

Definition
segmentedControl.setValue(value)
Parameters

value

The value.

Type string | number | boolean | object | array

Examples

Set the current value of segmentedControl to userValue.

segmentedControl.setValue(userValue);

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
ChangeThe value is changed.