# 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.

![User message](<../images/user-message.png>)

### 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.

![AI message](<../images/ai-message.png>)

### 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

![User message elements](<../images/user-message-elements.png>)

> 1. 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.

![Message user actions](<../images/user-message-actions.png>)

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](<https://element.siemens.io/components/chat-messages/ai-chat/>).

![User message attachments](<../images/user-message-attachments.png>)

### AI message

![AI message elements](<../images/ai-message-elements.png>)

> 1. 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.

![AI message actions](<../images/ai-message-actions.png>)

### Responsive behavior

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

![Chat message responsive](<../images/chat-message-responsive.png>)

## Code

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject } from '@angular/core';
import { SiUserMessageComponent, Attachment } from '@siemens/element-ng/chat-messages';
import { SiMarkdownComponent } from '@siemens/element-ng/markdown';
import { MenuItemAction } from '@siemens/element-ng/menu';
import { LOG_EVENT } from '@siemens/live-preview';

import { markdownOptions } from './markdown-options';

@Component({
  selector: 'app-sample',
  imports: [SiUserMessageComponent, SiMarkdownComponent],
  templateUrl: './si-user-message.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);

  protected markdownOptions = markdownOptions;

  content = `Can you help me with this **code snippet**?

\`console.log('Hello World')\`

I'm getting an error when I run it.`;

  attachments: Attachment[] = [
    {
      name: 'error-log.txt'
    },
    {
      name: 'screenshot.png'
    }
  ];

  actions: MenuItemAction[] = [
    {
      type: 'action',
      label: 'Edit message',
      icon: 'element-edit',
      action: (messageId: string) => this.logEvent(`Edit message ${messageId}`)
    },
    {
      type: 'action',
      label: 'Copy message',
      icon: 'element-export',
      action: (messageId: string) => this.logEvent(`Copy message ${messageId}`)
    },
    {
      type: 'action',
      label: 'Delete message',
      icon: 'element-delete',
      action: (messageId: string) => this.logEvent(`Delete message ${messageId}`)
    }
  ];
}
```

Template:

```html
<div class="p-4">
  <si-user-message actionParam="message-1" [attachments]="attachments" [actions]="actions">
    <si-markdown [markdown]="content" [options]="markdownOptions" />
  </si-user-message>
</div>
```

### [SiUserMessageComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-user-message.component.ts#L45-L87>)

**Kind:** component

**Selector:** `si-user-message`

```
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](<../../../api/siemens/element-ng/components/SiChatContainerComponent/index.html#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](<index.html#SiChatMessageComponent>) for the base message wrapper component

See: [SiAiMessageComponent](<index.html#SiAiMessageComponent>) for the AI message component

See: [SiAttachmentListComponent](<index.html#SiAttachmentListComponent>) for the base attachment component

See: [SiChatContainerComponent](<../../../api/siemens/element-ng/components/SiChatContainerComponent/index.html#SiChatContainerComponent>) for the chat container to use this within

```
component SiUserMessageComponent
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [actionParam](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-user-message.component.ts#L72-L72>) | `any` |  | Parameter to pass to action handlers |
| [actions](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-user-message.component.ts#L57-L57>) | `MenuItemAction[]` | `[]` | Primary message actions (edit, delete, copy, etc.). All actions displayed inline |
| [attachments](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-user-message.component.ts#L69-L69>) | `Attachment[]` | `[]` | List of attachments included with this message |
| [content](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-user-message.component.ts#L50-L50>) | `string` | `''` | The user message content |
| [secondaryActions](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-user-message.component.ts#L63-L63>) | `MenuItemAction[]` | `[]` | Secondary actions available in dropdown menu, first use primary actions and only add secondary actions additionally |
| [secondaryActionsLabel](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-user-message.component.ts#L82-L84>) | `TranslatableString` | `` $localize`:@@SI_USER_MESSAGE.SECONDARY_ACTIONS:Additional actions` `` | More actions button aria label |

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject } from '@angular/core';
import {
  elementBookmark,
  elementCopy,
  elementRefresh,
  elementShare,
  elementThumbsDown,
  elementThumbsUp
} from '@siemens/element-icons';
import { SiAiMessageComponent } from '@siemens/element-ng/chat-messages';
import { addIcons } from '@siemens/element-ng/icon';
import { SiMarkdownCitation, SiMarkdownComponent } from '@siemens/element-ng/markdown';
import { MenuItemAction } from '@siemens/element-ng/menu';
import { SourceReference } from '@siemens/element-ng/source-chip';
import { LOG_EVENT } from '@siemens/live-preview';

import { markdownOptions } from './markdown-options';

@Component({
  selector: 'app-sample',
  imports: [SiAiMessageComponent, SiMarkdownComponent],
  templateUrl: './si-ai-message.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);

  protected markdownOptions = markdownOptions;

  protected readonly icons = addIcons({
    elementThumbsUp,
    elementThumbsDown,
    elementCopy,
    elementRefresh,
    elementBookmark,
    elementShare
  });

  content = `Here's a **simple response** with basic formatting.

You can use \`inline code\` and create lists:

- First item [1]
- Second item [2]
- **Bold text** for emphasis
- _Italic text_ for subtle emphasis
`;

  actions: MenuItemAction[] = [
    {
      type: 'action',
      label: 'Good response',
      icon: this.icons.elementThumbsUp,
      action: (messageId: string) => this.logEvent(`Thumbs up for message ${messageId}`)
    },
    {
      type: 'action',
      label: 'Bad response',
      icon: this.icons.elementThumbsDown,
      action: (messageId: string) => this.logEvent(`Thumbs down for message ${messageId}`)
    },
    {
      type: 'action',
      label: 'Copy response',
      icon: this.icons.elementCopy,
      action: (messageId: string) => this.logEvent(`Copy message ${messageId}`)
    }
  ];

  secondaryActions: MenuItemAction[] = [
    {
      type: 'action',
      label: 'Retry response',
      icon: this.icons.elementRefresh,
      action: (messageId: string) => this.logEvent(`Retry message ${messageId}`)
    },
    {
      type: 'action',
      label: 'Bookmark',
      icon: this.icons.elementBookmark,
      action: (messageId: string) => this.logEvent(`Bookmark message ${messageId}`)
    },
    {
      type: 'action',
      label: 'Share',
      icon: this.icons.elementShare,
      action: (messageId: string) => this.logEvent(`Share message ${messageId}`)
    }
  ];

  sources: SourceReference[] = [
    {
      name: 'Data Analysis Guide',
      url: 'https://example.com/guides/data-analysis',
      quote: 'Start by reviewing the dataset structure and validating the input data.'
    },
    {
      name: 'Large Dataset Performance Guide',
      url: 'https://example.com/guides/large-datasets',
      description: 'Recommendations for processing production datasets with millions of rows.'
    }
  ];

  inlineSources: SiMarkdownCitation[] = [
    {
      identifier: '1',
      name: 'First source',
      url: 'https://example.com/guides/data-analysis',
      quote: 'Start by reviewing the dataset structure and validating the input data.'
    },
    {
      identifier: '2',
      name: 'Second source',
      url: 'https://example.com/guides/large-datasets',
      description: 'Recommendations for processing production datasets with millions of rows.'
    }
  ];
}
```

Template:

```html
<div class="p-2">
  <si-ai-message
    actionParam="message-1"
    [actions]="actions"
    [secondaryActions]="secondaryActions"
    [loading]="false"
    [sources]="sources"
    (sourceClicked)="logEvent($event)"
  >
    <si-markdown
      [markdown]="content"
      [options]="markdownOptions"
      [citations]="inlineSources"
      (extensionEvent)="logEvent($event)"
    />
  </si-ai-message>

  <div class="mt-5">
    <si-ai-message [loading]="true" />
  </div>
</div>
```

### [SiAiMessageComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-ai-message.component.ts#L44-L90>)

**Kind:** component

**Selector:** `si-ai-message`

```
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](<../../../api/siemens/element-ng/components/SiChatContainerComponent/index.html#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](<index.html#SiChatMessageComponent>) for the base message wrapper component

See: [SiUserMessageComponent](<index.html#SiUserMessageComponent>) for the user message component

See: [SiChatContainerComponent](<../../../api/siemens/element-ng/components/SiChatContainerComponent/index.html#SiChatContainerComponent>) for the chat container to use this within

```
component SiAiMessageComponent
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [actionParam](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-ai-message.component.ts#L71-L71>) | `unknown` |  | Parameter to pass to action handlers |
| [actions](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-ai-message.component.ts#L62-L62>) | `MenuItemAction[]` | `[]` | Primary actions available for this message (thumbs up/down, copy, retry, etc.) All actions displayed inline |
| [content](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-ai-message.component.ts#L49-L49>) | `string` | `''` | The AI-generated message content |
| [loading](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-ai-message.component.ts#L55-L55>) | `boolean` | `false` | Whether the message is currently being generated (shows skeleton) |
| [secondaryActions](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-ai-message.component.ts#L68-L68>) | `MenuItemAction[]` | `[]` | Secondary actions available in dropdown menu, first use primary actions and only add secondary actions additionally |
| [secondaryActionsLabel](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-ai-message.component.ts#L84-L86>) | `TranslatableString` | `` $localize`:@@SI_AI_MESSAGE.SECONDARY_ACTIONS:Additional actions` `` | More actions button aria label |
| [sources](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-ai-message.component.ts#L74-L74>) | `SourceReference[] \| undefined` |  | Source references |

#### Output Properties

| Name | Type | Description |
| --- | --- | --- |
| [sourceClicked](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-ai-message.component.ts#L89-L89>) | `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.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { CdkMenuTrigger } from '@angular/cdk/menu';
import { Component, inject } from '@angular/core';
import {
  elementBookmark,
  elementDelete,
  elementEdit,
  elementExport,
  elementOptionsVertical,
  elementUser
} from '@siemens/element-icons';
import { SiAvatarComponent } from '@siemens/element-ng/avatar';
import {
  SiChatMessageComponent,
  SiAttachmentListComponent,
  Attachment,
  SiChatMessageActionDirective
} from '@siemens/element-ng/chat-messages';
import { addIcons, SiIconComponent } from '@siemens/element-ng/icon';
import { SiMarkdownComponent } from '@siemens/element-ng/markdown';
import {
  MenuItemAction,
  SiMenuActionService,
  SiMenuFactoryComponent
} from '@siemens/element-ng/menu';
import { SiTranslatePipe } from '@siemens/element-translate-ng/translate';
import { LOG_EVENT } from '@siemens/live-preview';

import { markdownOptions } from './markdown-options';

@Component({
  selector: 'app-sample',
  imports: [
    CdkMenuTrigger,
    SiChatMessageComponent,
    SiMarkdownComponent,
    SiIconComponent,
    SiAvatarComponent,
    SiAttachmentListComponent,
    SiChatMessageActionDirective,
    SiMenuFactoryComponent,
    SiTranslatePipe
  ],
  templateUrl: './si-chat-message.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);
  private readonly menuActionService = inject(SiMenuActionService, { optional: true });

  protected markdownOptions = markdownOptions;

  protected readonly icons = addIcons({
    elementUser,
    elementOptionsVertical,
    elementExport,
    elementEdit,
    elementBookmark,
    elementDelete
  });

  actions: MenuItemAction[] = [
    {
      type: 'action',
      label: 'Copy',
      icon: this.icons.elementExport,
      action: (messageId: string) => this.logEvent(`Copy message ${messageId}`)
    },
    {
      type: 'action',
      label: 'Edit',
      icon: this.icons.elementEdit,
      action: (messageId: string) => this.logEvent(`Edit message ${messageId}`)
    }
  ];

  secondaryActions: MenuItemAction[] = [
    {
      type: 'action',
      label: 'Bookmark',
      icon: this.icons.elementBookmark,
      action: (messageId: string) => this.logEvent(`Bookmark message ${messageId}`)
    },
    {
      type: 'action',
      label: 'Delete',
      icon: this.icons.elementDelete,
      action: (messageId: string) => this.logEvent(`Delete message ${messageId}`)
    }
  ];

  attachments: Attachment[] = [
    {
      name: 'error-log.txt'
    },
    {
      name: 'screenshot.png'
    }
  ];

  readonly secondaryActionsLabel = 'More actions';

  protected runAction(action: MenuItemAction, messageId: string): void {
    if (typeof action.action === 'function') {
      action.action(messageId, action);
    } else {
      this.menuActionService?.actionTriggered(action, messageId);
    }
  }
}
```

Template:

```html
<div class="p-4">
  <si-chat-message alignment="start" actionsPosition="bottom">
    <si-attachment-list [attachments]="attachments" />
    <si-icon class="icon" [icon]="icons.elementUser" />
    <si-markdown
      markdown="Can you help me with this **code snippet**? I'm getting an error when I run it."
      [options]="markdownOptions"
    />
    <div class="btn-group" role="group" siChatMessageAction>
      @for (action of actions; track $index) {
        <button
          type="button"
          class="btn btn-tertiary-ghost"
          [class.btn-icon]="!!action.icon"
          [disabled]="action.disabled"
          [attr.aria-label]="action.label | translate"
          (click)="runAction(action, 'message-1')"
        >
          @if (action.icon) {
            <si-icon [icon]="action.icon" />
          } @else {
            {{ action.label | translate }}
          }
        </button>
      }
      <button
        type="button"
        class="btn btn-tertiary-ghost btn-icon"
        [cdkMenuTriggerFor]="secondaryActionsMenu"
        [attr.aria-label]="secondaryActionsLabel | translate"
        [attr.title]="secondaryActionsLabel | translate"
      >
        <si-icon [icon]="icons.elementOptionsVertical" />
      </button>
    </div>

    <ng-template #secondaryActionsMenu>
      <si-menu-factory actionParam="message-1" [items]="secondaryActions" />
    </ng-template>
  </si-chat-message>

  <div class="mt-5">
    <si-chat-message alignment="end" actionsPosition="side">
      <si-avatar size="small" initials="JD" altText="User" />
      Thanks for the help! That worked perfectly.
      <div class="btn-group" role="group" siChatMessageAction>
        @for (action of actions; track $index) {
          <button
            type="button"
            class="btn btn-tertiary-ghost"
            [class.btn-icon]="!!action.icon"
            [disabled]="action.disabled"
            [attr.aria-label]="action.label | translate"
            (click)="runAction(action, 'message-2')"
          >
            @if (action.icon) {
              <si-icon [icon]="action.icon" />
            } @else {
              {{ action.label | translate }}
            }
          </button>
        }
      </div>
    </si-chat-message>
  </div>

  <div class="mt-5">
    <si-chat-message alignment="start" [loading]="true">
      <si-icon class="icon" icon="element-user" />
    </si-chat-message>
  </div>

  <div class="mt-5">
    <si-chat-message alignment="end" actionsPosition="side" [loading]="true">
      <si-attachment-list [attachments]="attachments" />
      <si-icon class="icon" [icon]="icons.elementUser" />
    </si-chat-message>
  </div>
</div>
```

### [SiChatMessageComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-chat-message.component.ts#L47-L65>)

**Kind:** component

**Selector:** `si-chat-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](<index.html#SiUserMessageComponent>) and [SiAiMessageComponent](<index.html#SiAiMessageComponent>). Can be used within [SiChatContainerComponent](<../../../api/siemens/element-ng/components/SiChatContainerComponent/index.html#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](<index.html#SiUserMessageComponent>) for user message display

See: [SiAiMessageComponent](<index.html#SiAiMessageComponent>) for AI message display

See: [SiAttachmentListComponent](<index.html#SiAttachmentListComponent>) for attachment list to slot in

See: [SiChatMessageActionDirective](<../../../api/siemens/element-ng/directives/SiChatMessageActionDirective/index.html#SiChatMessageActionDirective>) for action buttons to slot in

See: [SiChatContainerComponent](<../../../api/siemens/element-ng/components/SiChatContainerComponent/index.html#SiChatContainerComponent>) for the chat container to use this within

```
component SiChatMessageComponent
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [actionsPosition](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-chat-message.component.ts#L64-L64>) | `"side" \| "bottom"` | `'side'` | Where to display action buttons (if any) |
| [alignment](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-chat-message.component.ts#L58-L58>) | `"start" \| "end"` | `'start'` | Alignment of the message |
| [loading](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-chat-message.component.ts#L52-L52>) | `boolean` | `false` | Whether the message is currently loading |

### Attachment list

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject, TemplateRef, viewChild } from '@angular/core';
import { SiAttachmentListComponent, Attachment } from '@siemens/element-ng/chat-messages';
import { LOG_EVENT } from '@siemens/live-preview';

@Component({
  selector: 'app-sample',
  imports: [SiAttachmentListComponent],
  templateUrl: './si-attachment-list.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);
  private readonly modalTemplate = viewChild<TemplateRef<any>>('modalTemplate');

  attachments: Attachment[] = [
    {
      name: 'quarterly-report.xlsx',
      previewTemplate: () => this.modalTemplate()!
    },
    {
      name: 'screenshot.png',
      previewTemplate: () => this.modalTemplate()!
    },
    {
      name: 'very-long-filename-that-demonstrates-text-truncation-behavior.pdf',
      previewTemplate: () => this.modalTemplate()!
    },
    {
      name: 'data.csv',
      previewTemplate: () => this.modalTemplate()!
    },
    {
      name: 'audio.mp3',
      previewTemplate: () => this.modalTemplate()!
    }
  ];

  readOnlyAttachments: Attachment[] = [
    {
      name: 'final-report.docx',
      previewTemplate: () => this.modalTemplate()!
    },
    {
      name: 'diagram.jpg',
      previewTemplate: () => this.modalTemplate()!
    },
    {
      name: 'config.json',
      previewTemplate: () => this.modalTemplate()!
    }
  ];

  onRemoveAttachment(attachment: Attachment): void {
    this.logEvent(`Remove attachment: ${attachment.name}`);

    this.attachments = this.attachments.filter(a => a !== attachment);
  }
}
```

Template:

```html
<div class="p-2">
  <si-attachment-list
    alignment="start"
    removeLabel="Remove attachment"
    [attachments]="attachments"
    [removable]="true"
    (remove)="onRemoveAttachment($event)"
  />

  <div class="mt-5">
    <si-attachment-list alignment="start" [attachments]="readOnlyAttachments" [removable]="false" />
  </div>
</div>

<ng-template #modalTemplate let-modalRef="modalRef" let-attachment="attachment">
  <div class="modal-header">
    <h4 class="modal-title" id="sample-modal-title">{{ attachment.name }}</h4>
    <button
      type="button"
      class="btn btn-circle btn-tertiary-ghost element-cancel"
      aria-label="Close modal"
      (click)="modalRef.hide('cancel')"
    >
    </button>
  </div>
  <div class="modal-body">
    <span>This is a sample modal to demonstrate attachment preview functionality.</span>
  </div></ng-template
>
```

### [SiAttachmentListComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-attachment-list.component.ts#L55-L118>)

**Kind:** component

**Selector:** `si-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](<index.html#SiUserMessageComponent>), [SiAiMessageComponent](<index.html#SiAiMessageComponent>) and [SiChatInputComponent](<../../../api/siemens/element-ng/components/SiChatInputComponent/index.html#SiChatInputComponent>) but can also be used inside custom chat messages with [SiChatMessageComponent](<index.html#SiChatMessageComponent>)

See: [SiUserMessageComponent](<index.html#SiUserMessageComponent>) for user message display

See: [SiAiMessageComponent](<index.html#SiAiMessageComponent>) for AI message display

See: [SiChatMessageComponent](<index.html#SiChatMessageComponent>) for custom chat message display

See: [SiChatInputComponent](<../../../api/siemens/element-ng/components/SiChatInputComponent/index.html#SiChatInputComponent>) for chat input with attachment support

See: [Attachment](<index.html#t:Attachment>) for attachment data structure

```
component SiAttachmentListComponent
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [alignment](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-attachment-list.component.ts#L69-L69>) | `"start" \| "end"` | `'start'` | Whether to align attachments to the end (right) or start (left) |
| [attachments](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-attachment-list.component.ts#L63-L63>) | `Attachment[]` | `[]` | List of attachments to display |
| [removable](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-attachment-list.component.ts#L75-L75>) | `boolean` | `false` | Whether to show remove buttons on attachments |
| [removeLabel](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-attachment-list.component.ts#L86-L88>) | `TranslatableString` | `` $localize`:@@SI_ATTACHMENT_LIST.REMOVE_ATTACHMENT:Remove {{attachment}}` `` | Label for remove attachment button. The attachment name is available with `{{attachment}}`. |

#### Output Properties

| Name | Type | Description |
| --- | --- | --- |
| [remove](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-attachment-list.component.ts#L93-L93>) | `Attachment` | Emitted when an attachment should be removed |

### Types Documentation

### [Attachment](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-attachment-list.component.ts#L20-L25>)

**Kind:** interface

```
import type { Attachment } from '@siemens/element-ng/chat-messages';
```

Attachment item interface for file attachments in chat messages, used by [SiAttachmentListComponent](<index.html#SiAttachmentListComponent>) and inside [SiUserMessageComponent](<index.html#SiUserMessageComponent>) as well as [SiChatInputComponent](<../../../api/siemens/element-ng/components/SiChatInputComponent/index.html#SiChatInputComponent>).

See: [SiAttachmentListComponent](<index.html#SiAttachmentListComponent>) for the attachment list component

See: [SiUserMessageComponent](<index.html#SiUserMessageComponent>) for the user message

See: [SiChatInputComponent](<../../../api/siemens/element-ng/components/SiChatInputComponent/index.html#SiChatInputComponent>) for the chat input component

```
interface Attachment
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [name](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-attachment-list.component.ts#L22-L22>) | `string` | File name |
| [previewTemplate](<https://github.com/siemens/element/blob/main/projects/element-ng/chat-messages/si-attachment-list.component.ts#L24-L24>) (optional) | `TemplateRef<any> \| (() => TemplateRef<any>)` | Optionally show a preview of the attachment by providing a template that is shown in a modal when clicked (optional) |

### [MenuItemAction](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L34-L41>)

**Kind:** interface

```
import type { MenuItemAction } from '@siemens/element-ng/menu';
```

```
interface MenuItemAction extends MenuItemBase
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [action](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L40-L40>) | `string \| ((actionParam: any, source: MenuItemAction) => void)` | Action that called when the item is triggered. A function will be called, a string will be dispatched to the [SiMenuActionService](<../../../api/siemens/element-ng/types/SiMenuActionService/index.html#t:SiMenuActionService>). |
| [badge](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L21-L21>) (optional, inherited) | `string \| number` | Badge that is rendered after the label.<br><br>Inherited from [MenuItemBase](<index.html#t:MenuItemBase>) |
| [badgeColor](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L23-L23>) (optional, inherited) | `string` | Color of the badge (not iconBadge).<br><br>Inherited from [MenuItemBase](<index.html#t:MenuItemBase>) |
| [disabled](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L25-L25>) (optional, inherited) | `boolean` | Whether the menu item id disabled.<br><br>Inherited from [MenuItemBase](<index.html#t:MenuItemBase>) |
| [icon](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L14-L14>) (optional, inherited) | `string` | Optional icon that will be rendered before the label.<br><br>Inherited from [MenuItemBase](<index.html#t:MenuItemBase>) |
| [iconBadge](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L19-L19>) (optional, inherited) | `string \| number \| boolean` | Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered.<br><br>Inherited from [MenuItemBase](<index.html#t:MenuItemBase>) |
| [id](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L10-L10>) (optional, inherited) | `string` | ID that will be attached to the DOM node.<br><br>Inherited from [MenuItemBase](<index.html#t:MenuItemBase>) |
| [label](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L12-L12>) (inherited) | `TranslatableString` | Label that is shown to the user.<br><br>Inherited from [MenuItemBase](<index.html#t:MenuItemBase>) |
| [type](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L35-L35>) | `"action"` |  |

### [SourceReference](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L7-L16>)

**Kind:** interface

```
import type { SourceReference } from '@siemens/element-ng/source-chip';
```

Definition of a single source

```
interface SourceReference
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [description](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L13-L13>) (optional) | `string` | Optional source description. |
| [name](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L9-L9>) | `string` | Source name displayed to the user. |
| [quote](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L15-L15>) (optional) | `string` | Optional source quote. Takes precedence over [description](<index.html#t:SourceReference.description>). |
| [url](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L11-L11>) | `string` | Source URL. |

### [TranslatableString](<https://github.com/siemens/element/blob/main/projects/element-translate-ng/translate-types/global.types.ts#L18-L18>)

**Kind:** type alias

```
import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';
```

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.

```
type TranslatableString = string & Translatable
```

### [MenuItemBase](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L8-L26>)

**Kind:** interface

```
import type { MenuItemBase } from '@siemens/element-ng/menu';
```

```
interface MenuItemBase
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [badge](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L21-L21>) (optional) | `string \| number` | Badge that is rendered after the label. |
| [badgeColor](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L23-L23>) (optional) | `string` | Color of the badge (not iconBadge). |
| [disabled](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L25-L25>) (optional) | `boolean` | Whether the menu item id disabled. |
| [icon](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L14-L14>) (optional) | `string` | Optional icon that will be rendered before the label. |
| [iconBadge](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L19-L19>) (optional) | `string \| number \| boolean` | Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered. |
| [id](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L10-L10>) (optional) | `string` | ID that will be attached to the DOM node. |
| [label](<https://github.com/siemens/element/blob/main/projects/element-ng/menu/si-menu-model.ts#L12-L12>) | `TranslatableString` | Label that is shown to the user. |
