Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 1x 48x 48x 48x | /**
* Copyright (c) Siemens 2016 - 2025
* SPDX-License-Identifier: MIT
*/
import { Component, input } from '@angular/core';
import { SiResponsiveContainerDirective } from '@siemens/element-ng/resize-observer';
/**
* 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 {@link SiUserMessageComponent} and {@link SiAiMessageComponent}.
* Can be used within {@link 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 {@link SiMarkdownRendererComponent} 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 {@link SiUserMessageComponent} for user message display
* @see {@link SiAiMessageComponent} for AI message display
* @see {@link SiAttachmentListComponent} for attachment list to slot in
* @see {@link SiChatMessageActionDirective} for action buttons to slot in
* @see {@link SiMarkdownRendererComponent} for markdown content rendering
* @see {@link SiChatContainerComponent} for the chat container to use this within
*
* @experimental
*/
@Component({
selector: 'si-chat-message',
templateUrl: './si-chat-message.component.html',
styleUrl: './si-chat-message.component.scss',
host: {
class: 'd-block'
},
hostDirectives: [SiResponsiveContainerDirective]
})
export class SiChatMessageComponent {
/**
* Whether the message is currently loading
* @defaultValue false
*/
readonly loading = input(false);
/**
* Alignment of the message
* @defaultValue 'start'
*/
readonly alignment = input<'start' | 'end'>('start');
/**
* Where to display action buttons (if any)
* @defaultValue 'side'
*/
readonly actionsPosition = input<'side' | 'bottom'>('side');
}
|