Chat message¶
The chat message represents an individual message in a conversational interface.
Usage¶
The chat message displays conversational content exchanged between participants. It helps users follow the dialogue and distinguish who sent each message.
There are two variants:
- User message: represents the message sent by the user
- AI message: represents the automated or system-generated response
User message¶
Displayed as a text bubble, the user message visually represents the user’s contribution to a conversation. It may support contextual actions such as copy, edit, or delete.
Use it in chat interfaces where user input is shown as part of a dialogue, or in conversation histories and transcripts.

AI message¶
The AI message visually distinguishes automated responses from user input. It can include optional actions or related content relevant to the user.
Use it to display AI-generated content in chat interfaces, or to provide system-driven assistance, explanations, or follow-up actions.

Best practices¶
- Allow user interaction (feedback, retry, copy) when appropriate.
- Always place the AI message directly in the background. Do not wrap it in an additional container.
- Constrain the AI message to a maximum width of 720px for readability.
Design¶
User message¶

- Actions (optional), 2. Message bubble, 3. User message
Actions are revealed on hover for desktop users, and on tap for mobile users where hover interactions aren’t supported.

When attachments are included in a user message, they should appear above the message bubble. Attachments are arranged horizontally and wrap to the next line when they exceed the available space.
For general attachment errors (e.g., file not supported), display an inline error message above the field, following the AI chat guidelines.

AI message¶

- AI icon, 2. AI message, 3. Actions (optional)
When actions are present, they’re always positioned below the text area. Is possible to display up to 4 actions inline; any additional actions will be collapsed into a menu.

Responsive behavior¶
For all breakpoints, the layout remains the same. The text reflows to fit the available space while preserving hierarchy and alignment.

Code¶
import { SiUserMessageComponent } from '@siemens/element-ng/chat-messages';User message component for displaying the user's messages in conversational interfaces.
The user message component renders user-submitted content in (AI) chat interfaces, supporting text, attachments, and contextual actions. It appears as a text bubble aligned to the right side. Can be used within SiChatContainerComponent.
The component automatically handles:
• Styling for user messages distinct from AI or generic chat messages
• Displaying attachments above the message bubble
• Displaying primary and secondary actions
See: SiChatMessageComponent for the base message wrapper component
See: SiAiMessageComponent for the AI message component
See: SiAttachmentListComponent for the base attachment component
See: SiChatContainerComponent for the chat container to use this within
Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| actionParam ¶ | any | Parameter to pass to action handlers | |
| actions ¶ | MenuItemAction[] | [] | Primary message actions (edit, delete, copy, etc.). All actions displayed inline |
| attachments ¶ | Attachment[] | [] | List of attachments included with this message |
| content ¶ | string | '' | The user message content |
| secondaryActions ¶ | MenuItemAction[] | [] | Secondary actions available in dropdown menu, first use primary actions and only add secondary actions additionally |
| secondaryActionsLabel ¶ | TranslatableString | $localize`:@@SI_USER_MESSAGE.SECONDARY_ACTIONS:Additional actions` | More actions button aria label |
import { SiAiMessageComponent } from '@siemens/element-ng/chat-messages';AI message component for displaying AI-generated responses in conversational interfaces.
The AI message component renders AI-generated content in chat interfaces, supporting text, loading states, and contextual actions. It appears as text (no bubble) aligned to the left side without any avatar/icon slot. Can be used within SiChatContainerComponent.
The component automatically handles:
• Styling for AI messages distinct from user or generic chat messages
• Showing loading states with skeleton UI during generation
• Displaying primary and secondary actions
See: SiChatMessageComponent for the base message wrapper component
See: SiUserMessageComponent for the user message component
See: SiChatContainerComponent for the chat container to use this within
Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| actionParam ¶ | unknown | Parameter to pass to action handlers | |
| actions ¶ | MenuItemAction[] | [] | Primary actions available for this message (thumbs up/down, copy, retry, etc.) All actions displayed inline |
| content ¶ | string | '' | The AI-generated message content |
| loading ¶ | boolean | false | Whether the message is currently being generated (shows skeleton) |
| secondaryActions ¶ | MenuItemAction[] | [] | Secondary actions available in dropdown menu, first use primary actions and only add secondary actions additionally |
| secondaryActionsLabel ¶ | TranslatableString | $localize`:@@SI_AI_MESSAGE.SECONDARY_ACTIONS:Additional actions` | More actions button aria label |
| sources ¶ | SourceReference[] | undefined | Source references |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| sourceClicked ¶ | SourceReference | Emitted when a source has been clicked. |
Base chat message¶
Use these base components to build custom chat message interfaces.
The si-chat-message component is a wrapper component, it has slots for different parts of a chat message.
The slots are:
si-attachment-list/si-badge- For displaying attachments related to the message.si-avatar/si-icon/img- For the avatar or icon representing the message sender.siChatMessageAction (helper directive)- For actions related to the message.
import { SiChatMessageComponent } from '@siemens/element-ng/chat-messages';Base declarative chat message component that provides the layout structure for chat messages.
This component handles the core message layout including avatar positioning, loading states, and action button as well as attachment list placement. It serves as the foundation for more specialized message components like SiUserMessageComponent and SiAiMessageComponent. Can be used within SiChatContainerComponent.
The component provides:
• Flexible alignment (start/end) for different message types
• Avatar/icon slot for message attribution
• Loading state with skeleton UI
• Action buttons positioned on the side or bottom
• Attachment list display slot
• Responsive behavior that adapts to container size
This is a low-level component designed for slotting in custom content, it provides slots via content projection:
• Default content: Main message content area (consider using si-markdown for markdown support)
• si-avatar/si-icon/img selector: Avatar or icon representing the message sender
• si-chat-message-action selector: Action buttons related to the message
• si-attachment-list selector: Attachment list component for displaying file attachments
See: SiUserMessageComponent for user message display
See: SiAiMessageComponent for AI message display
See: SiAttachmentListComponent for attachment list to slot in
See: SiChatMessageActionDirective for action buttons to slot in
See: SiChatContainerComponent for the chat container to use this within
Input Properties¶
Attachment list¶
import { SiAttachmentListComponent } from '@siemens/element-ng/chat-messages';Attachment list component for displaying file attachments in chat messages.
This component renders a list of file attachments with icons, names, and optional preview and remove functionality. It's designed to work with chat message components to show files that have been uploaded or shared in conversations.
This component provides:
• A list of pills showing each attachment's name and an icon
• Optional preview modal for attachments
• Optional remove functionality for editable messages
The component is included within SiUserMessageComponent, SiAiMessageComponent and SiChatInputComponent but can also be used inside custom chat messages with SiChatMessageComponent
See: SiUserMessageComponent for user message display
See: SiAiMessageComponent for AI message display
See: SiChatMessageComponent for custom chat message display
See: SiChatInputComponent for chat input with attachment support
See: Attachment for attachment data structure
Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| alignment ¶ | "start" | "end" | 'start' | Whether to align attachments to the end (right) or start (left) |
| attachments ¶ | Attachment[] | [] | List of attachments to display |
| removable ¶ | boolean | false | Whether to show remove buttons on attachments |
| removeLabel ¶ | TranslatableString | $localize`:@@SI_ATTACHMENT_LIST.REMOVE_ATTACHMENT:Remove {{attachment}}` | Label for remove attachment button. The attachment name is available with |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| remove ¶ | Attachment | Emitted when an attachment should be removed |
Types Documentation¶
Attachment item interface for file attachments in chat messages, used by SiAttachmentListComponent and inside SiUserMessageComponent as well as SiChatInputComponent.
See: SiAttachmentListComponent for the attachment list component
See: SiUserMessageComponent for the user message
See: SiChatInputComponent for the chat input component
-
File name
-
Optionally show a preview of the attachment by providing a template that is shown in a modal when clicked (optional)
previewTemplate?:
TemplateRef<any> | (() => TemplateRef<any>)¶
-
Action that called when the item is triggered. A function will be called, a string will be dispatched to the SiMenuActionService.
action:
string | ((actionParam: any, source: MenuItemAction) => void)¶ -
Badge that is rendered after the label.
badge?:
string | numberInherited from MenuItemBase¶ -
Color of the badge (not iconBadge).
badgeColor?:
stringInherited from MenuItemBase¶ -
Whether the menu item id disabled.
disabled?:
booleanInherited from MenuItemBase¶ -
Optional icon that will be rendered before the label.
icon?:
stringInherited from MenuItemBase¶ -
Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered.
iconBadge?:
string | number | booleanInherited from MenuItemBase¶ -
ID that will be attached to the DOM node.
id?:
stringInherited from MenuItemBase¶ -
Label that is shown to the user.
label:
TranslatableStringInherited from MenuItemBase¶
Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit. Equivalent to a normal string in usage and functionality.
-
Badge that is rendered after the label.
-
Color of the badge (not iconBadge).
-
Whether the menu item id disabled.
-
Optional icon that will be rendered before the label.
-
Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered.
-
ID that will be attached to the DOM node.
-
Label that is shown to the user.
Except where otherwise noted, content on this site is licensed under MIT License.