Skip to main content

The Comment Thread component for Retool Apps

An interface to display and enter comments.

For more information about using this component, refer to the Comment Thread guide.

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.

autoRefreshInterval

The frequency, in seconds, at which to reload data.

Type number
Mutability
ControlUsage
Retool UI Inspector

avatarFallback

The text that is displayed when there is no Image URL or icon.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector
Examples
"Jenny Appleseed"

avatarIcon

The icon that's displayed for the avatar.

Type string
Format Icon Key
Mutability
ControlUsage
Retool UI Inspector
Examples
"/icon:bold/user"

avatarImageSize

The size of the avatar image.

Type string
Mutability
ControlUsage
Retool UI Inspector

avatarSrc

The image URL to use for the avatar.

Type string
Format URL
Mutability
ControlUsage
Retool UI Inspector
Examples
"https://example.com/image.jpg"

data

The data.

Type string | number | boolean | object | array
Format Custom data
Mutability
ControlUsage
Retool UI Inspector
MethodcopyToClipboard()

disableSubmit

Whether to disable form submission.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

emptyDescription

The description to display before the first message is sent.

Type string
Mutability
ControlUsage
Retool UI Inspector

emptyTitle

The title to display before the first message is sent.

Type string
Mutability
ControlUsage
Retool UI Inspector

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

id

The unique identifier (name).

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector
Default
commentThread1
Examples
query1
button1

isHiddenOnDesktop

Whether to show or hide this object in the desktop layout.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Appearance > Advanced > Show on desktop
Default
false
Examples
true

isHiddenOnMobile

Whether to show or hide this object in the mobile layout.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Appearance > Advanced > Show on mobile
Default
true
Examples
true

maintainSpaceWhenHidden

Whether to take up space on the canvas if hidden is true.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Appearance > Advanced > Maintain space when hidden
Default
false
Examples
true

margin

The amount of margin to render outside.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector > Spacing > Margin
Allowed Values
ValueUI OptionDescription
4px 8pxNormal

Normal margin.

0None

No margin.

Default
4px 8px
Examples
4px 8px

placeholder

The text to display within the input field when there is no value.

Type string
Formatstring
Mutability
ControlUsage
Retool UI Inspector > Content > Placeholder
Default
Enter a value
Examples
Enter a value

showAvatar

Whether to display an avatar.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

showEmptyState

Whether to display an empty state before a message is sent. Enabled by adding the Empty state add-on.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

showInEditor

Whether the component remains visible in the editor if hidden is true.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Appearance > Advanced > Always show in edit mode
Default
false
Examples
true

showTimestamp

Whether to display a timestamp for messages.

Type array
Array values boolean
Mutability
ControlUsage
Retool UI Inspector

showTitle

Whether to display the title.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

style

Custom style options.

Type object
Mutability
ControlUsage
Retool UI Inspector > Appearance > style

threadId

The ID with which to record comments. You can reference dynamic values, such as table1.selectedRow.id, to switch between comment threads automatically.

Type string
Mutability
ControlUsage
Retool UI Inspector

title

The title text to display.

Type string
Mutability
ControlUsage
Retool UI Inspector

value

The value.

Type string | number | boolean | object | 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.

commentThread.clearValue()

Clear the current values.

Definition
commentThread.clearValue()
Examples

Clear the current value of commentThread.

commentThread.clearValue();

commentThread.exportData()

Exports data as a file in a CSV, TSV, JSON, or Excel format.

Definition
commentThread.exportData(options)
Parameters

options

The options for the export.

Type object
Object Properties

data

The data.

Type string | number | boolean | object | array
Format Custom data

fileName

The file name.

Type string

fileType

The file extension.

Type string



commentThread.resetValue()

Reset the current value to the default value.

Definition
commentThread.resetValue()
Examples

Reset the current value of commentThread.

commentThread.resetValue();

commentThread.scrollIntoView()

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

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

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

commentThread.sendMessage()

Send the current message.

Definition
commentThread.sendMessage()

commentThread.setHidden()

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

Definition
commentThread.setHidden(hidden)
Parameters

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Hide commentThread.

commentThread.setHidden(true);

Unhide commentThread.

commentThread.setHidden(false);

commentThread.setValue()

Set the current value.

Definition
commentThread.setValue(value)
Parameters

value

The value.

Type string | number | boolean | object | array

Examples

Set the current value of commentThread to userValue.

commentThread.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
Click ActionAn action button is clicked or pressed.
SubmitThe value is submitted.