A chat UI component for displaying messages, attachments, and input interaction.
- Slots
-
prefix— Content before the title, such as an avatar or an icon. -
title— The title of the header. -
actions— The actions of the header. -
suggestions-header— The header of the suggestions list. -
suggestions— The whole suggestions list. -
suggestions-actions— Additional actions next to the suggestions. -
suggestion— Suggestions that replace the default items. -
empty-state— The content shown while there are no messages. -
typing-indicator— The typing indicator of the other side.
- CSS Parts
-
chat-container— Styles the main chat container. -
header— Styles the chat header container. -
message-area-container— Styles the container holding the messages and (optional) suggestions. -
message-list— Styles the message list container. -
message-item— Styles each message wrapper. -
typing-indicator— Styles the typing indicator container. -
typing-dot— Styles individual typing indicator dots. -
suggestions-container— Styles the container holding all suggestions. -
suggestions-header— Styles the suggestions header. -
suggestion— Styles each suggestion item. -
suggestion-prefix— Styles the icon or prefix in a suggestion. -
suggestion-title— Styles the text/title of a suggestion. -
empty-state— Styles the empty state container when there are no messages. -
input-area-container— Styles the wrapper around the chat input area. -
input-area— Styles the input area: the attachments, the text input and the actions. -
input-container— Styles the wrapper around the text input. -
input-attachments-container— Styles the container for attachments in the input. -
input-attachment-container— Styles a single attachment in the input area. -
input-attachment-name— Styles the file name of an attachment. -
input-attachment-icon— Styles the icon of an attachment. -
text-input— Styles the text input field for typing messages. -
input-actions-container— Styles the container for input actions. -
input-actions-start— Styles the group of actions at the start of the input after the default file upload. -
input-actions-end— Styles the group of actions at the end of the input. -
file-upload-container— Styles the container for the file upload input. -
file-upload— Styles the label that holds the file upload button and the file input. -
send-button-container— Styles the container around the send button. -
send-button— Styles the send button. -
message-container— Styles the container of a single message. -
message-header— Styles the header of a message. The header is empty without a `messageHeader` renderer. -
message-content— Styles the text content of a message. -
message-attachments-container— Styles the container for message attachments. -
message-attachment— Styles a single message attachment. -
message-actions-container— Styles the container holding message actions. -
message-sent— Added to the message container of a message from the current user. -
attachment-header— Styles the header of an attachment block. -
attachment-content— Styles the content of an attachment block. -
attachment-icon— Styles the icon of an attachment. -
file-name— Styles the file name shown in an attachment.
Properties
Section titled "Properties"draftMessage
Section titled "draftMessage"The chat message currently being composed but not yet sent. Includes the draft text and any attachments.
draftMessage: IgrChatDraftMessage messages
Section titled "messages"The list of chat messages currently displayed. Use this property to set or update the message history.
messages: IgrChatMessage[] options
Section titled "options"The configuration object of the chat: behavior and appearance options, suggestions and custom renderers.
options: IgrChatOptions | undefined resourceStrings
Section titled "resourceStrings"The resource strings of the chat.
resourceStrings: IgrChatResourceStrings & IChatResourceStrings Methods
Section titled "Methods"focusInput
Section titled "focusInput"Moves the focus to the text area of the chat input, after the first render
of a new chat. The promise resolves when the focus moves. A disconnected
chat does not wait. Does nothing when a custom input renderer replaces
the text area.
focusInput(options: FocusOptions): Promise<void> Parameters
- options:
FocusOptions
Returns Promise<void>
scrollToMessage
Section titled "scrollToMessage"Scrolls the view to a specific message by id.
scrollToMessage(messageId: string): void Parameters
- messageId:
string
Returns void
Events
Section titled "Events"onAttachmentAdded
Section titled "onAttachmentAdded"Dispatched when the user adds attachments with drag and drop or with the default file input. Cancelable: a canceled event does not add them.
onAttachmentAdded(args: CustomEvent<IgrChatMessageAttachment[]>): void Parameters
- args:
CustomEvent<IgrChatMessageAttachment[]>
Returns void
onAttachmentClick
Section titled "onAttachmentClick"Dispatched when the user clicks the header of a message attachment.
onAttachmentClick(args: CustomEvent<IgrChatMessageAttachment>): void Parameters
Returns void
onAttachmentDrag
Section titled "onAttachmentDrag"Dispatched when the user drags files into the input area.
onAttachmentDrag(args: CustomEvent<void>): void Parameters
- args:
CustomEvent<void>
Returns void
onAttachmentDrop
Section titled "onAttachmentDrop"Dispatched when the user drops files on the input area.
onAttachmentDrop(args: CustomEvent<void>): void Parameters
- args:
CustomEvent<void>
Returns void
onAttachmentRemoved
Section titled "onAttachmentRemoved"Dispatched when the user removes an attachment from the input. Cancelable: a canceled event keeps the attachment.
onAttachmentRemoved(args: CustomEvent<IgrChatMessageAttachment>): void Parameters
Returns void
onInputBlur
Section titled "onInputBlur"Dispatched when the chat input field loses focus.
onInputBlur(args: CustomEvent<void>): void Parameters
- args:
CustomEvent<void>
Returns void
onInputChange
Section titled "onInputChange"Dispatched when the content of the chat input changes.
onInputChange(args: CustomEvent<string>): void Parameters
- args:
CustomEvent<string>
Returns void
onInputFocus
Section titled "onInputFocus"Dispatched when the chat input field gains focus.
onInputFocus(args: CustomEvent<void>): void Parameters
- args:
CustomEvent<void>
Returns void
onMessageCreated
Section titled "onMessageCreated"Dispatched when the user sends a message, also with a click on a suggestion. Cancelable: a canceled event does not add the message.
onMessageCreated(args: CustomEvent<IgrChatMessage>): void Parameters
- args:
CustomEvent<IgrChatMessage>
Returns void
onMessageReact
Section titled "onMessageReact"Dispatched when the user clicks an action button of a message, for example like or copy.
onMessageReact(args: CustomEvent<IgrChatMessageReaction>): void Parameters
Returns void
onNavigate
Section titled "onNavigate"Dispatched when a plain click or Enter opens a link in a message in the same tab, before the browser navigates. Cancel it to route on the client. Does not bubble.
onNavigate(args: CustomEvent<IgrChatMessageLink>): void Parameters
- args:
CustomEvent<IgrChatMessageLink>
Returns void
onTypingChange
Section titled "onTypingChange"Dispatched when the user starts or stops typing. The detail is
onTypingChange(args: CustomEvent<boolean>): void Parameters
- args:
CustomEvent<boolean>