Components/ChatComposer
Universal Component

ChatComposer

Message composer for AI chat input, attachments, keyboard send, and custom toolbars.

This page was migrated by AI, please review carefully

Migration is complete, but please validate against source code and manual review.

ChatComposer

Message composer for AI chat input, attachments, keyboard send, and custom toolbars.

import { ref } from 'vue' const text = ref('') const sent = ref<string[]>([]) function onSend(payload: { text: string }) { sent.value.unshift(payload.text) text.value = '' }

Basic Usage

ChatComposer

Demo will load when visible.
<template>
  <TxChatComposer v-model="text" @send="onSend" />
</template>

API

Props

PropTypeDefaultDescription
modelValuestring''Textarea value for v-model.
placeholderstring'Message…'Textarea placeholder.
disabledbooleanfalseDisables input, send, and attachment actions.
submittingbooleanfalseMarks the composer as submitting and blocks send.
allowAttachmentWhileSubmittingbooleanfalseAllows attachment action while submitting.
minRowsnumber3Textarea rows.
maxRowsnumber6Reserved maximum rows value for consumers.
sendOnEnterbooleantrueEnables keyboard send behavior.
sendOnMetaEnterbooleantrueRequires Meta/Ctrl+Enter when sending from keyboard.
allowEmptySendbooleanfalseAllows attachment-only send when text is empty.
sendButtonTextstring'Send'Default send button text.
showAttachmentButtonbooleanfalseShows the default attachment button.
attachmentButtonTextstring'Attach'Default attachment button text.
attachmentsChatComposerAttachment[][]Attachment chips rendered above the textarea.

Events

EventParamsDescription
update:modelValuestringEmitted from textarea input.
send{ text: string }Emitted with trimmed text when send is allowed.
attachmentClick-Emitted when the attachment action is allowed.
pasteClipboardEventForwarded from textarea paste.
focusFocusEventForwarded from textarea focus.
blurFocusEventForwarded from textarea blur.

Slots

SlotScopeDescription
attachments{ attachments }Replaces the default attachment chips.
toolbar{ send, disabled, attachmentClick }Replaces the default action row.
toolbar-left{ disabled }Adds content to the left side of the default action row.
actions{ send, disabled }Adds content before the default send button.
footer-Renders footer content below the action row.

Interaction Contract

  • Send payload text is trimmed.
  • Empty text is blocked unless allowEmptySend=true and at least one attachment exists.
  • disabled and submitting block send; disabled also blocks attachment actions.
  • Attachment actions are blocked while submitting unless allowAttachmentWhileSubmitting=true.
  • With sendOnMetaEnter=true, keyboard send requires Meta/Ctrl+Enter; with it disabled, Enter sends and Shift+Enter inserts a newline.
  • Custom toolbar receives callable send and attachmentClick functions and replaces the default action row.