ChatInput

A message composer with an auto-resizing textarea, an emoji picker, and file attachments — Enter sends, Shift+Enter for a newline.

html
<UiChatInput />

Model value

modelValue is the draft text, bound with v-model. Enter sends and Shift+Enter adds a newline; on send the component clears the draft for you and hands the content to the send event, so you never have to reset it yourself.

Type to try the ChatInput

Attachments

attachments is the list of pending files, shown as removable chips above the textarea. Bind it with v-model:attachments when you want to add files from outside the composer — a drop zone elsewhere on the page — and, like the draft, it's cleared for you once the message is sent.

Pending: nothing

Placeholder

placeholder is the hint in the empty textarea, “Message...” by default. Naming the room or the person — “Message #design” — is what most chat apps do, and it doubles as a reminder of where the message is about to go.

Disabled

disabled locks the textarea and every button in the composer, for while a send request is outstanding.

Loading

loading swaps the send button's icon for a spinner and disables it, for while a previous message is still in flight.

Variant

variant picks between the ringed outline composer and the filled, ringless soft one. Reach for soft when the composer sits inside a card that already has its own border.

Color

color only tints the send button. The composer's own ring and background stay neutral regardless, so the accent lands on the one thing you click.

Allow attachments

allowAttachments shows the paperclip that opens the native file picker, and is on by default. Turn it off wherever files have nowhere to go — a comment box, a support widget — rather than accepting them and dropping them silently.

Allow emojis

allowEmojis shows the emoji button, which opens a picker that inserts into the draft at the cursor. It's on by default; turning both this and allowAttachments off leaves the plain text composer below.

Multiple

multiple decides whether the file picker takes more than one file at a time, and is on by default. Set it false where the message can only carry one thing — an avatar upload, a single receipt — so the constraint is enforced in the dialog rather than explained afterwards.

Accept

accept is the comma-separated list of types the file picker offers, passed straight to the underlying file input — MIME types like image/* or extensions like .pdf. It filters the dialog rather than validating the result, so still check what arrives.

Max rows

maxRows is how tall the textarea grows before it starts scrolling instead, six rows by default. Lower it where the composer sits in a tight panel and a long draft would push the conversation off the screen.


API Reference

Generated from the component's source — props, slots and emits as the component actually declares them.

Props

Prop
Type
Default
Description
string
''
The controlled value of the message draft.
File[]
[]
The controlled list of pending attachments, shown as removable chips above the textarea.
string
'Message...'
Placeholder text shown when the draft is empty.
boolean
false
Disables the whole input — textarea, attachment/emoji buttons, and send button.
boolean
false
Shows a loading state on the send button (a spinning loader instead of the paper-plane icon) and disables it — e.g. while a previous message is still being sent.
"outline" | "soft"
'outline'
The visual style of the composer.
"neutral" | "primary" | "secondary" | "success" | "error" | "warning" | "info" | "pending"
'primary'
The color of the send button. Doesn't affect the composer's own ring/background — those stay neutral regardless, per `variant`.
boolean
true
Shows the paperclip button that opens the native file picker.
boolean
true
Shows the emoji button that opens a picker for inserting emoji into the draft.
boolean
true
Whether the file picker allows selecting more than one file at a time.
string
Comma-separated list of accepted file types (e.g. 'image/*', '.pdf'), passed straight through to the file input.
number
6
Maximum number of rows the textarea grows to before it starts scrolling.

Slots

Slot
actions

Emits

Event
Payload
Description
update:modelValue
[value: string]
update:attachments
[files: File[]]
send
[payload: { content: string; attachments: File[] }]
Fired when the send button is clicked, or Enter is pressed without Shift, while there's a non-empty draft and/or at least one attachment. Also clears the draft and attachments (via `update:modelValue`/`update:attachments`) — if you don't want that, re-set them yourself in response to this event.
remove-attachment
[file: File, index: number]

Types

ts
type Variant = "outline" | "soft";
ts
type Color = "neutral" | "primary" | "secondary" | "success" | "error" | "warning" | "info" | "pending";