A chat UI component for displaying messages, attachments, and input interaction.
- Element
-
igc-chat
- 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"tagName
Section titled "tagName"The tagName read-only property of the Element interface returns the tag name of the element on which it's called.
tagName: "igc-chat" = 'igc-chat' Defined in src/components/chat/chat.ts:236
Accessors
Section titled "Accessors"draftMessage
Section titled "draftMessage"get draftMessage(): any Defined in src/components/chat/chat.ts:322
The chat message currently being composed but not yet sent. Includes the draft text and any attachments.
set draftMessage(value: IgcChatDraftMessage): void Defined in src/components/chat/chat.ts:322
Parameters
- value:
IgcChatDraftMessage
Returns void
messages
Section titled "messages"get messages(): any Defined in src/components/chat/chat.ts:309
The list of chat messages currently displayed. Use this property to set or update the message history.
set messages(value: IgcChatMessage[]): void Defined in src/components/chat/chat.ts:309
Parameters
- value:
IgcChatMessage[]
Returns void
options
Section titled "options"get options(): any Defined in src/components/chat/chat.ts:341
The configuration object of the chat: behavior and appearance options, suggestions and custom renderers.
set options(value: IgcChatOptions): void Defined in src/components/chat/chat.ts:341
Parameters
- value:
IgcChatOptions
Returns void
resourceStrings
Section titled "resourceStrings"get resourceStrings(): any Defined in src/components/chat/chat.ts:354
The resource strings of the chat.
set resourceStrings(value: IgcChatResourceStrings | IChatResourceStrings): void Defined in src/components/chat/chat.ts:354
Parameters
- value:
IgcChatResourceStrings | IChatResourceStrings
Returns void
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> Defined in src/components/chat/chat.ts:408
Parameters
- options:
FocusOptions
Returns Promise<void>
scrollToMessage
Section titled "scrollToMessage"Scrolls the view to a specific message by id.
scrollToMessage(messageId: string): void Defined in src/components/chat/chat.ts:396
Parameters
- messageId:
string
Returns void
Events
Section titled "Events"igcAttachmentAdded
Section titled "igcAttachmentAdded"Dispatched when the user adds attachments with drag and drop or with the default file input. Cancelable: a canceled event does not add them.
igcAttachmentAdded: CustomEvent<IgcChatMessageAttachment[]> Defined in src/components/chat/chat.ts:90
igcAttachmentClick
Section titled "igcAttachmentClick"Dispatched when the user clicks the header of a message attachment.
igcAttachmentClick: CustomEvent<IgcChatMessageAttachment> Defined in src/components/chat/chat.ts:77
igcAttachmentDrag
Section titled "igcAttachmentDrag"Dispatched when the user drags files into the input area.
igcAttachmentDrag: CustomEvent<void> Defined in src/components/chat/chat.ts:103
igcAttachmentDrop
Section titled "igcAttachmentDrop"Dispatched when the user drops files on the input area.
igcAttachmentDrop: CustomEvent<void> Defined in src/components/chat/chat.ts:109
igcAttachmentRemoved
Section titled "igcAttachmentRemoved"Dispatched when the user removes an attachment from the input. Cancelable: a canceled event keeps the attachment.
igcAttachmentRemoved: CustomEvent<IgcChatMessageAttachment> Defined in src/components/chat/chat.ts:97
igcInputBlur
Section titled "igcInputBlur"Dispatched when the chat input field loses focus.
igcInputBlur: CustomEvent<void> Defined in src/components/chat/chat.ts:124
igcInputChange
Section titled "igcInputChange"Dispatched when the content of the chat input changes.
igcInputChange: CustomEvent<string> Defined in src/components/chat/chat.ts:129
igcInputFocus
Section titled "igcInputFocus"Dispatched when the chat input field gains focus.
igcInputFocus: CustomEvent<void> Defined in src/components/chat/chat.ts:119
igcMessageCreated
Section titled "igcMessageCreated"Dispatched when the user sends a message, also with a click on a suggestion. Cancelable: a canceled event does not add the message.
igcMessageCreated: CustomEvent<IgcChatMessage> Defined in src/components/chat/chat.ts:67
igcMessageReact
Section titled "igcMessageReact"Dispatched when the user clicks an action button of a message, for example like or copy.
igcMessageReact: CustomEvent<IgcChatMessageReaction> Defined in src/components/chat/chat.ts:72
igcNavigate
Section titled "igcNavigate"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.
igcNavigate: CustomEvent<IgcChatMessageLink> Defined in src/components/chat/chat.ts:83
igcTypingChange
Section titled "igcTypingChange"Dispatched when the user starts or stops typing. The detail is true while the user types.
igcTypingChange: CustomEvent<boolean> Defined in src/components/chat/chat.ts:114