The Chat component for Retool Apps
An interface for AI chat conversations.
Refer to Getting started with the Chat component for more information about this component.
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.
assistantName
The name of the AI.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
"Retool AI"
avatarFallback
The text that is displayed when there is no Image URL or icon.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
|
Examples
"Jenny Appleseed"
avatarIcon
The icon that's displayed for the avatar.
Type | string | ||||
Format | Icon Key | ||||
Mutability |
|
Examples
"/icon:bold/user"
avatarSrc
The image URL to use for the avatar.
Type | string | ||||
Format | URL | ||||
Mutability |
|
Examples
"https://example.com/image.jpg"
data
The data.
Type | string | number | boolean | object | array | ||||||
Format | Custom data | ||||||
Mutability |
|
disableSubmit
Whether to disable form submission.
Type | boolean | ||||
Mutability |
|
emptyDescription
The description to display before the first message is sent.
Type | string | ||||
Mutability |
|
emptyTitle
The title to display before the first message is sent.
Type | string | ||||
Mutability |
|
hidden
Whether this object is hidden from view.
Type | boolean | ||||||
Format | True/False | ||||||
Mutability |
| ||||||
Default |
|
Examples
true
id
The unique identifier (name).
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
query1
button1
isHiddenOnDesktop
Whether to show or hide this object in the desktop layout.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
isHiddenOnMobile
Whether to show or hide this object in the mobile layout.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
maintainSpaceWhenHidden
Whether to take up space on the canvas if hidden
is true
.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
margin
The amount of margin to render outside.
Type | string | |||||||||
Format | Plain Text | |||||||||
Mutability |
| |||||||||
Allowed Values |
| |||||||||
Default |
|
Examples
4px 8px
messageHistory
A list of messages previously sent and received.
Type | array |
Array values | string |
Mutability | Read-only |
placeholder
The text to display within the input field when there is no value.
Type | string | ||||
Format | string | ||||
Mutability |
| ||||
Default |
|
Examples
Enter a value
queryTargetId
The ID of the query to send messageHistory
to.
Type | string | ||||
Mutability |
|
showEmptyState
Whether to display an empty state before a message is sent. Enabled by adding the Empty state add-on.
Type | boolean | ||||
Mutability |
|
showHeader
Whether to show the header area.
Type | boolean | ||||||
Format | True/False | ||||||
Mutability |
| ||||||
Default |
|
Examples
true
showInEditor
Whether the component remains visible in the editor if hidden
is true
.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
showTimestamp
Whether to display a timestamp for messages.
Type | array | ||||
Array values | boolean | ||||
Mutability |
|
style
Custom style options.
Type | object | ||||
Mutability |
|
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
chat.clearHistory()
Examples
Clear the history from chat
.
chat.clearHistory();
chat.clearValue()
Examples
Clear the current value of chat
.
chat.clearValue();
chat.exportData(options)
chat.resetValue()
Examples
Reset the current value of chat
.
chat.resetValue();
chat.scrollIntoView()
Scrolls the canvas or parent container so that the selected component appears in the visible area.
chat.scrollIntoView(options)
Parameters
Object Properties
behavior
The scroll behavior.
Type | string | ||||||
Allowed Values |
|
block
The scroll position relative to the component.
Type | string | ||||||||||
Allowed Values |
|
Examples
Scroll the minimum amount to immediately bring chat
into view.
chat.scrollIntoView({behavior: 'auto', block: 'nearest'});
chat.setHidden()
Set the hidden
value to toggle whether the component is visible. Defaults to true
without a parameter.
chat.setHidden(hidden)
Parameters
Examples
true
Examples
Hide chat
.
chat.setHidden(true);
Unhide chat
.
chat.setHidden(false);
chat.setShowHeader(showHeader)
Parameters
Examples
true
Examples
Show the header of chat
.
chat.setShowHeader(true);
Hide the header of chat
.
chat.setShowHeader(false);
chat.setValue(value)
Examples
Set the current value of chat
to userValue
.
chat.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.
Event | Description |
---|