Skip to content

InputMessage

Chat-style message composer with an auto-resizing textarea, flexible left/right action slots, and a built-in send button on a Surface-2 substrate.

Installation

Install InputMessage from the Fluid Effect UI registry.

Basic

Suggestions

Suggested prompt: Why is every other input box so stiff?. Press Tab to fill the composer.

Attachments

Caller-owned attachment previews, a keyboard-accessible picker, and a transcript that retains sent messages.

  • micka.png
  • Receipt-2581-4039-8265.pdf

Queued messages

Stream, queue, edit, reorder, remove and stop. Queue dispatch remains caller-owned.

Help me polish the dashboard design
Thinking…
  1. micka.pngReceipt-2581-4039-8265.pdfMatch these mockups

Transcript

Send a message to try a streaming reply, then scroll away and jump back to the latest line.

Why do chat apps scroll so badly?
Mostly because the page has two jobs that pull against each other. It has to keep up with text that is still arriving, and it has to stay still while you read.
What does a good one do?
It follows the reply only while you are at the bottom. The moment you scroll up it lets go, and it gives you one button to come back.
Suggested prompt: How does the scrolling work?. Press Tab to fill the composer.

Left Slot Only

Right Slot Only

Send Handler

Disabled

API Reference

Types come from the public API. A dash indicates no default is documented here.

InputMessage props

Public source
PropTypeDefaultDescription
keyKeepAliveKey<K, Ends> | undefined''The child's identity among its parent's children of one component, or a kept child's among its author's. The empty string by default.
onEmit
Show type
((events: { readonly _tag: "Focused"; } | { readonly _tag: "Blurred"; } | { readonly _tag: "ValueChanged"; readonly value: string; } | { readonly _tag: "FilesPicked"; readonly files: readonly File[]; } | { readonly _tag: "FilesRejected"; readonly reason: "too-many-files" | "invalid-type"; } | { readonly _tag: "RemoveFileRequested"; readonly id: string; } | { readonly _tag: "Sent"; readonly text: string; readonly files: readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]; readonly queuedId: string | null; } | { readonly _tag: "QueueRequested"; readonly text: string; readonly files: readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]; } | { readonly _tag: "Stopped"; } | { readonly _tag: "EditQueuedRequested"; readonly id: string; } | { readonly _tag: "RemoveQueuedRequested"; readonly id: string; } | { readonly _tag: "MoveQueuedRequested"; readonly id: string; readonly direction: 1 | -1; }) => NoInfer<Msg> | undefined) | { readonly ValueChanged: (event: { readonly _tag: "ValueChanged"; readonly value: string; }) => NoInfer<Msg> | undefined; readonly FilesPicked: (event: { readonly _tag: "FilesPicked"; readonly files: readonly File[]; }) => NoInfer<Msg> | undefined; readonly FilesRejected: (event: { readonly _tag: "FilesRejected"; readonly reason: "too-many-files" | "invalid-type"; }) => NoInfer<Msg> | undefined; readonly RemoveFileRequested: (event: { readonly _tag: "RemoveFileRequested"; readonly id: string; }) => NoInfer<Msg> | undefined; readonly Sent: (event: { readonly _tag: "Sent"; readonly text: string; readonly files: readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]; readonly queuedId: string | null; }) => NoInfer<Msg> | undefined; readonly QueueRequested: (event: { readonly _tag: "QueueRequested"; readonly text: string; readonly files: readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]; }) => NoInfer<Msg> | undefined; readonly Stopped: (event: { readonly _tag: "Stopped"; }) => NoInfer<Msg> | undefined; readonly EditQueuedRequested: (event: { readonly _tag: "EditQueuedRequested"; readonly id: string; }) => NoInfer<Msg> | undefined; readonly RemoveQueuedRequested: (event: { readonly _tag: "RemoveQueuedRequested"; readonly id: string; }) => NoInfer<Msg> | undefined; readonly MoveQueuedRequested: (event: { readonly _tag: "MoveQueuedRequested"; readonly id: string; readonly direction: 1 | -1; }) => NoInfer<Msg> | undefined; readonly Focused: (event: { readonly _tag: "Focused"; }) => NoInfer<Msg> | undefined; readonly Blurred: (event: { readonly _tag: "Blurred"; }) => NoInfer<Msg> | undefined; } | undefined
—Handle the child's events with a callback, or supply one handler per tag for tagged events. Return a parent message to dispatch it, or `undefined` to ignore the event.
props.idstringRequired
props.valuestringRequired
props.disabledbooleanfalse
props.size"default" | "compact"'default'
props.classNamestring—
props.shape"rounded" | "pill" | "sharp"—
props.placeholderstring'Ask me anything…'
props.queue
Show type
readonly { readonly id: string; readonly text: string; readonly files: readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]; }[]
[]
props.status"idle" | "streaming"—
props.multiplebooleantrue
props.acceptreadonly string[]['image/png', 'image/jpeg', 'application/pdf']
props.actionSlotsboolean—
props.files
Show type
readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]
[]
props.supportsQueueboolean—
props.supportsStopboolean—
props.supportsFilesboolean—
props.showQueueboolean—
props.fileTrigger"visible" | "focus-only"—
props.placeholderSuggestionstring—
props.suggestionsreadonly string[][]
props.textareaLabelstring'Message'
props.textareaDescribedBystring—
props.textareaClassNamestring—
props.sendLabelstring'Send'
props.minRowsnumber1
props.liveMessagestring''
slotsSC & CheckedSlots<"left" | "right", SC, NoInfer<Msg>>—
InputMessageWithActions
Public source
PropTypeDefaultDescription
keystring | undefined''The child's identity among its parent's children of one component. The empty string by default.
onEmit
Show type
((events: { readonly _tag: "Focused"; } | { readonly _tag: "Blurred"; } | { readonly _tag: "ValueChanged"; readonly value: string; } | { readonly _tag: "FilesPicked"; readonly files: readonly File[]; } | { readonly _tag: "FilesRejected"; readonly reason: "too-many-files" | "invalid-type"; } | { readonly _tag: "RemoveFileRequested"; readonly id: string; } | { readonly _tag: "Sent"; readonly text: string; readonly files: readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]; readonly queuedId: string | null; } | { readonly _tag: "QueueRequested"; readonly text: string; readonly files: readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]; } | { readonly _tag: "Stopped"; } | { readonly _tag: "EditQueuedRequested"; readonly id: string; } | { readonly _tag: "RemoveQueuedRequested"; readonly id: string; } | { readonly _tag: "MoveQueuedRequested"; readonly id: string; readonly direction: 1 | -1; }) => NoInfer<Msg> | undefined) | { readonly ValueChanged: (event: { readonly _tag: "ValueChanged"; readonly value: string; }) => NoInfer<Msg> | undefined; readonly FilesPicked: (event: { readonly _tag: "FilesPicked"; readonly files: readonly File[]; }) => NoInfer<Msg> | undefined; readonly FilesRejected: (event: { readonly _tag: "FilesRejected"; readonly reason: "too-many-files" | "invalid-type"; }) => NoInfer<Msg> | undefined; readonly RemoveFileRequested: (event: { readonly _tag: "RemoveFileRequested"; readonly id: string; }) => NoInfer<Msg> | undefined; readonly Sent: (event: { readonly _tag: "Sent"; readonly text: string; readonly files: readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]; readonly queuedId: string | null; }) => NoInfer<Msg> | undefined; readonly QueueRequested: (event: { readonly _tag: "QueueRequested"; readonly text: string; readonly files: readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]; }) => NoInfer<Msg> | undefined; readonly Stopped: (event: { readonly _tag: "Stopped"; }) => NoInfer<Msg> | undefined; readonly EditQueuedRequested: (event: { readonly _tag: "EditQueuedRequested"; readonly id: string; }) => NoInfer<Msg> | undefined; readonly RemoveQueuedRequested: (event: { readonly _tag: "RemoveQueuedRequested"; readonly id: string; }) => NoInfer<Msg> | undefined; readonly MoveQueuedRequested: (event: { readonly _tag: "MoveQueuedRequested"; readonly id: string; readonly direction: 1 | -1; }) => NoInfer<Msg> | undefined; readonly Focused: (event: { readonly _tag: "Focused"; }) => NoInfer<Msg> | undefined; readonly Blurred: (event: { readonly _tag: "Blurred"; }) => NoInfer<Msg> | undefined; } | undefined
—Handle the child's events with a callback, or supply one handler per tag for tagged events. Return a parent message to dispatch it, or `undefined` to ignore the event.
props.idstringRequired
props.valuestringRequired
props.disabledbooleanfalse
props.size"default" | "compact"'default'
props.classNamestring—
props.shape"rounded" | "pill" | "sharp"—
props.placeholderstring'Ask me anything…'
props.queue
Show type
readonly { readonly id: string; readonly text: string; readonly files: readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]; }[]
[]
props.status"idle" | "streaming"—
props.multiplebooleantrue
props.acceptreadonly string[]['image/png', 'image/jpeg', 'application/pdf']
props.actionSlotsboolean—
props.files
Show type
readonly { readonly id: string; readonly size: number; readonly name: string; readonly type: string; readonly lastModified: number; readonly previewUrl?: string; }[]
[]
props.supportsQueueboolean—
props.supportsStopboolean—
props.supportsFilesboolean—
props.showQueueboolean—
props.fileTrigger"visible" | "focus-only"—
props.placeholderSuggestionstring—
props.suggestionsreadonly string[][]
props.textareaLabelstring'Message'
props.textareaDescribedBystring—
props.textareaClassNamestring—
props.sendLabelstring'Send'
props.minRowsnumber1
props.liveMessagestring''
slots{ readonly left?: View.Input<Msg, R>; readonly right?: View.Input<Msg, R>; }Required