Skip to content

Chat Composer Input

@astryxdesign/core v0.7.1 · ChatComposerInput

Props ​

PropTypeDefaultDescription
v-modelstring—The draft. Inside a ChatComposer, the shell's draft is used when this is omitted.
placeholderstringComposer's, then localized “Type a message…”Text shown only while the serialized draft is empty.
maxRowsnumber8Lines before the editor scrolls.
triggersChatComposerTrigger[]—Characters that open a suggestion list. Each trigger carries the character, a search source, and what to insert.
debounceMsnumber150Delay before an async trigger search. Synchronous sources are not delayed.
hasHistorybooleantrueArrow keys at the ends of the draft recall earlier submissions.
labelstringLocalized “Message input”Accessible name of the editor.
isDisabledbooleanComposer's valueStops editing. Falls back to the surrounding composer.
pasteAsToken{ onPaste } | falseBuilt-in thresholdLong pastes become chips. Pass a useChatPasteAsToken result to change the threshold, or false to insert the text as-is.
pasteAction(event, text) => boolean | void—First chance at a plain-text paste. Return true to keep the input from inserting the text itself.

Events ​

EventPayloadDescription
update:modelValuestringThe serialized draft, including chip values. This is what v-model binds.
changestringThe draft changed, by typing, pasting, or a programmatic insert.
submitstringEnter without Shift. Shift+Enter inserts a newline.
filesFile[]Files from a paste or a drop. A file drop does not navigate away.
keydownKeyboardEventKeydown after an open trigger menu has declined the event. Call preventDefault() to skip Enter-to-send and history recall.

Exposed ​

NameTypeDescription
insertToken(token) => string | undefinedInserts a chip at the caret and returns its id.
expandToken(id: string) => voidReplaces a chip with the text it serializes to.
insertText(text: string) => voidInserts plain text at the caret.
focus() => voidFocuses the editor and keeps a caret the user already had inside it.
getValue() => stringThe serialized draft, including chip values.