Chat Composer Input
@astryxdesign/core v0.7.1 · ChatComposerInput
Props
| Prop | Type | Default | Description |
|---|---|---|---|
v-model | string | — | The draft. Inside a ChatComposer, the shell's draft is used when this is omitted. |
placeholder | string | Composer's, then localized “Type a message…” | Text shown only while the serialized draft is empty. |
maxRows | number | 8 | Lines before the editor scrolls. |
triggers | ChatComposerTrigger[] | — | Characters that open a suggestion list. Each trigger carries the character, a search source, and what to insert. |
debounceMs | number | 150 | Delay before an async trigger search. Synchronous sources are not delayed. |
hasHistory | boolean | true | Arrow keys at the ends of the draft recall earlier submissions. |
label | string | Localized “Message input” | Accessible name of the editor. |
isDisabled | boolean | Composer's value | Stops editing. Falls back to the surrounding composer. |
pasteAsToken | { onPaste } | false | Built-in threshold | Long 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
| Event | Payload | Description |
|---|---|---|
update:modelValue | string | The serialized draft, including chip values. This is what v-model binds. |
change | string | The draft changed, by typing, pasting, or a programmatic insert. |
submit | string | Enter without Shift. Shift+Enter inserts a newline. |
files | File[] | Files from a paste or a drop. A file drop does not navigate away. |
keydown | KeyboardEvent | Keydown after an open trigger menu has declined the event. Call preventDefault() to skip Enter-to-send and history recall. |
Exposed
| Name | Type | Description |
|---|---|---|
insertToken | (token) => string | undefined | Inserts a chip at the caret and returns its id. |
expandToken | (id: string) => void | Replaces a chip with the text it serializes to. |
insertText | (text: string) => void | Inserts plain text at the caret. |
focus | () => void | Focuses the editor and keeps a caret the user already had inside it. |
getValue | () => string | The serialized draft, including chip values. |