SiChatInputComponent documentation¶
import { SiChatInputComponent } from '@siemens/element-ng/chat-messages'; Chat input component for composing and sending messages in conversational interfaces.
The chat input component provides a text area for users to compose messages, supporting text, attachments, and contextual actions. It appears as a textarea with buttons for adding attachments and sending messages, as well as an optional disclaimer.
The component automatically handles:
• Styling for chat input and actions.
• Dynamic resizing of the textarea based on content.
• Uploading of and displaying of attachments above the input area.
• Displaying primary and secondary actions.
Additionally to the inputs and outputs documented here, the component supports content projection via the following slots:
• Default content: Custom action buttons to display inline, prefer using the actions input for buttons, can be used in addition.
• siChatInputDisclaimer selector: Custom disclaimer content to display below the input area, prefer using the disclaimer input for simple text disclaimers.
See: SiAttachmentListComponent for the base attachment component
See: SiChatInputDisclaimerDirective to slot in custom disclaimer content
Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| accept ¶ | string | undefined | undefined | Accepted file types for attachments (as accept string) |
| actionParam ¶ | any | Parameter to pass to action handlers | |
| actions ¶ | MenuItemAction[] | [] | Primary actions available in the input. Provide at most one action. |
| allowAttachments ¶ | boolean | false | Whether file attachments are supported |
| attachFileLabel ¶ | TranslatableString | $localize`:@@SI_CHAT_INPUT.ATTACH_FILE:Attach file` | Attach file button aria label |
| attachments ¶ | ChatInputAttachment[] | [] | Current attachments |
| autoFocus ¶ | boolean | false | Auto-focus the input on component initialization |
| disabled ¶ | boolean | false | Whether the input is disabled |
| disclaimer ¶ | TranslatableString | undefined | A disclaimer to display. If not provided, the component will look for projected content with the | |
| followUpPrompts ¶ | string[] | [] | Suggested follow-up prompts to display as pill buttons above the chat input. Use |
| interruptButtonLabel ¶ | TranslatableString | $localize`:@@SI_CHAT_INPUT.INTERRUPT:Stop processing` | Interrupt button label |
| interruptible ¶ | boolean | false | Whether the input supports interrupting ongoing operations. When active, the send button transforms into an interrupt button (with element-stop-filled icon). If sending is true, the interrupt button will be disabled. |
| label ¶ | string | t(() => $localize`:@@SI_CHAT_INPUT.LABEL:Chat input`) | The label for the input, used for accessibility |
| maxFileSize ¶ | number | 10485760 (10MB) | Maximum file size in bytes |
| maxLength ¶ | number | undefined | Maximum number of characters allowed | |
| placeholder ¶ | TranslatableString | $localize`:@@SI_CHAT_INPUT.PLACEHOLDER:Enter a message…` | Placeholder text for the input |
| removeAttachmentLabel ¶ | TranslatableString | $localize`:@@SI_ATTACHMENT_LIST.REMOVE_ATTACHMENT:Remove {{attachment}}` | Remove attachment aria label. The attachment name is available with |
| secondaryActions ¶ | MenuItemAction[] | [] | Secondary actions available in dropdown menu |
| secondaryActionsLabel ¶ | TranslatableString | $localize`:@@SI_CHAT_INPUT.SECONDARY_ACTIONS:Additional actions` | More actions button aria label |
| sendButtonIcon ¶ | string | this.icons.elementSendFilled | Send button icon |
| sendButtonLabel ¶ | TranslatableString | $localize`:@@SI_CHAT_INPUT.SEND:Send` | Send button label |
| sending ¶ | boolean | false | Whether a message is currently being sent, also prevent the sending of new ones while still allowing the user to type |
| value ¶ | string | '' | Current input value |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| attachmentsChange ¶ | ChatInputAttachment[] | Current attachments |
| fileError ¶ | FileUploadError | Emitted when file upload errors occur |
| followUpPromptSelected ¶ | string | Emitted when the user selects a follow-up prompt. The emitted value is the text of the selected prompt. |
| interrupt ¶ | void | Emitted when the user wants to interrupt the current operation |
| interruptibleChange ¶ | boolean | Whether the input supports interrupting ongoing operations. When active, the send button transforms into an interrupt button (with element-stop-filled icon). If sending is true, the interrupt button will be disabled. |
| send ¶ | { content: string; attachments: ChatInputAttachment[]; } | Emitted when the user wants to send a message |
| sendingChange ¶ | boolean | Whether a message is currently being sent, also prevent the sending of new ones while still allowing the user to type |
| valueChange ¶ | string | Current input value |
Attributes and Methods¶
Types Documentation¶
Attachment item interface for file attachments in chat messages, extension of Attachment for SiAttachmentListComponent to use within SiChatInputComponent. Adds the action file information. Can be used within SiChatContainerComponent. See: Attachment for base attachment interface See: SiAttachmentListComponent for the attachment list component See: SiChatInputComponent for the chat input component See: SiChatContainerComponent for the base chat container component where this can be used See: SiAiChatComponent for the AI chat container where this needs to be used File object File name name : Optionally show a preview of the attachment by providing a template that is shown in a modal when clicked (optional) previewTemplate ? : File size in bytes MIME typeimport type { ChatInputAttachment } from '@siemens/element-ng/chat-messages';
string Inherited from Attachment ¶ TemplateRef<any> | (() => TemplateRef<any>) Inherited from Attachment ¶
Action that called when the item is triggered. A function will be called, a string will be dispatched to the SiMenuActionService. action : Badge that is rendered after the label. badge ? : Color of the badge (not iconBadge). badgeColor ? : Whether the menu item id disabled. disabled ? : Optional icon that will be rendered before the label. icon ? : Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered. iconBadge ? : ID that will be attached to the DOM node. id ? : Label that is shown to the user. label : import type { MenuItemAction } from '@siemens/element-ng/menu';
string | ((actionParam: any, source: MenuItemAction) => void) ¶ string | number Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ string | number | boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ TranslatableString Inherited from MenuItemBase ¶
Represents a translatable string. This can either be a translation key, e.g. import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';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.
errorParams ? : errorText : file : fileName : progress : size : status : import type { FileUploadError } from '@siemens/element-ng/file-uploader';
Record<string, unknown> Inherited from UploadFile ¶ TranslatableString Inherited from UploadFile ¶ File Inherited from UploadFile ¶ string Inherited from UploadFile ¶ number Inherited from UploadFile ¶ string Inherited from UploadFile ¶ "invalid" Inherited from UploadFile ¶
Badge that is rendered after the label. Color of the badge (not iconBadge). badgeColor ? : 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.import type { MenuItemBase } from '@siemens/element-ng/menu';
string ¶
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 ? : import type { Attachment } from '@siemens/element-ng/chat-messages';
TemplateRef<any> | (() => TemplateRef<any>) ¶
import type { UploadFile } from '@siemens/element-ng/file-uploader';
Except where otherwise noted, content on this site is licensed under MIT License.