Skip to main content

Chat

Rocket 2.0

The Chat component is a message thread with an input box, for building assistants, support chats or AI helpers. When the user sends a message, run a query in On message sent and add the reply with Append history.

Properties​

Property
Description
Expected Value
Chat titleTitle shown at the top of the chat.Text. Default: Chat
Initial chatMessages the chat starts with. Each is an object with message, messageId, timestamp, name, avatar and type (message, response or error). Changing it replaces the history.Array
User nameName shown on the user's messages.Text. Default: You
User avatarImage URL for the user's avatar. Without one, the user's initials are shown.Text
Respondent nameName shown on replies.Text. Default: Assistant
Respondent avatarImage URL for the respondent's avatar. Without one, the respondent's initials are shown.Text
Placeholder for input fieldHint text shown in the empty message box.Text. Default: Ask me anything!
Empty chat textText shown when the chat has no messages.Text. Default: Start the conversation
Disable input stateStops the user from typing or sending messages.On or off. Default: Off
History loading stateShows placeholder messages while the history loads.On or off. Default: Off
Response loading stateShows a typing indicator from the respondent and blocks sending until it is turned off.On or off. Default: Off
Enable clear history iconShows a button in the header that clears the history.On or off. Default: On
Enable download history iconShows a button in the header that downloads the history as a JSON file.On or off. Default: On
Show avatarsShows avatars next to messages.On or off. Default: On
Show timestampsShows the time next to each sender's name.On or off. Default: On

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On message sentTriggers when the user sends a message.
On history clearedTriggers when the user clears the history with the header button.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Append historyAdds Message to the history. Plain text is added as a reply; an object can set its own type.components.chat1.appendHistory("{{{}}}")
Clear historyResets the history to Initial chat without firing On history cleared.components.chat1.clearHistory()
Download chatDownloads the history as a JSON file.components.chat1.downloadChat()
Send messageAdds Message to the history as a message from the user, without firing On message sent.components.chat1.sendMessage("{{{}}}")
Set errorShows Error as an error message at the end of the chat. The next message added clears it.components.chat1.setError("")
Set historyReplaces the whole history with History, a list of message objects.components.chat1.setHistory("{{[]}}")
Set history loadingTurns the history loading placeholders on or off.components.chat1.setHistoryLoading("{{false}}")
Set input disableTurns off, or back on, the user's ability to type and send messages.components.chat1.setInputDisable("{{false}}")
Set respondent avatarChanges the respondent's avatar to the image URL in Avatar.components.chat1.setResponderAvatar("")
Set response loadingTurns the respondent's typing indicator on or off.components.chat1.setResponseLoading("{{false}}")
Set user avatarChanges the user's avatar to the image URL in Avatar.components.chat1.setUserAvatar("")
Set visibilityShows the component when true, hides it when false.components.chat1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.chat1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.chat1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
chatTitleTitle shown at the top of the chat.{{components.chat1.chatTitle}}
initialChatMessages the chat starts with. Each is an object with message, messageId, timestamp, name, avatar and type (message, response or error). Changing it replaces the history.{{components.chat1.initialChat}}
userNameName shown on the user's messages.{{components.chat1.userName}}
userAvatarImage URL for the user's avatar. Without one, the user's initials are shown.{{components.chat1.userAvatar}}
respondentNameName shown on replies.{{components.chat1.respondentName}}
respondentAvatarImage URL for the respondent's avatar. Without one, the respondent's initials are shown.{{components.chat1.respondentAvatar}}
placeholderHint text shown in the empty message box.{{components.chat1.placeholder}}
emptyTextText shown when the chat has no messages.{{components.chat1.emptyText}}
disableInputStops the user from typing or sending messages.{{components.chat1.disableInput}}
loadingHistoryShows placeholder messages while the history loads.{{components.chat1.loadingHistory}}
loadingResponseShows a typing indicator from the respondent and blocks sending until it is turned off.{{components.chat1.loadingResponse}}
enableClearHistoryButtonShows a button in the header that clears the history.{{components.chat1.enableClearHistoryButton}}
enableDownloadHistoryButtonShows a button in the header that downloads the history as a JSON file.{{components.chat1.enableDownloadHistoryButton}}
showAvatarsShows avatars next to messages.{{components.chat1.showAvatars}}
showTimestampsShows the time next to each sender's name.{{components.chat1.showTimestamps}}
historyAll messages in the chat, in order.{{components.chat1.history}}
isHistoryLoadingtrue while the history loading placeholders are shown.{{components.chat1.isHistoryLoading}}
isInputDisabledtrue while the user cannot type or send messages.{{components.chat1.isInputDisabled}}
isResponseLoadingtrue while the typing indicator is shown.{{components.chat1.isResponseLoading}}
lastMessageThe last message from the user. Use lastMessage.message to send its text to a query.{{components.chat1.lastMessage}}
lastResponseThe last reply added with Append history.{{components.chat1.lastResponse}}
isVisibleWhether the component is visible.{{components.chat1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.chat1.isLoading}}
isDisabledWhether the component is disabled.{{components.chat1.isDisabled}}

Styles​

Style
Default
BackgroundTheme: Surface 1
BorderTheme: Default border
Border radius—
Accent (own messages, send button, focus)Theme: Brand primary
Reply bubble backgroundTheme: Surface 3
Name colorTheme: Primary text
Message text colorTheme: Primary text
Timestamp colorTheme: Placeholder text
Input backgroundTheme: Surface 1
Input borderTheme: Default border
Input text colorTheme: Primary text
Send icon colorTheme: Surface 1
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.