Skip to content
ghostui

Preview

Design guidance

Use secondary for a task summary or approval. Keep draft files in the primary editor through attachmentContent. The compact LayerCard shows only its primary region until a secondary panel is supplied. Use secondaryVisible={false} to hide a retained panel. Send stays at the trailing edge with or without a model control.

Vercel AI SDK and TanStack AI hooks own transport and streaming state. See the native SDK examples for wiring Composer, messages, stop, approval, and file delivery.

Accessibility

Composer is a form. Enter submits a valid draft, Shift+Enter inserts a newline, and composing or IME key code 229 never submits. Native naming, focus, disabled, read-only, error, and status attributes pass through to the textarea. Failed sends retain the draft and announce the error.

Installation

Install
Source files

Basic usage

Structures

Examples

Default task

Draft a request, choose a model, optionally add a file, and send it. The local example records the submitted content.

Model and attachment composition

Arrange a caller-owned model selection and ready file beside the submit action.

receipt.pdf
invoice.csv

Prepared request and row sizing

Start with a prepared request and file while keeping the editor at two rows and capping it at four.

april-receipt.pdf

Attached task progress

Attach a caller-owned checklist when the request needs a few visible subtasks. The clock reports the actual completed count, and the rows can be collapsed without changing the draft.

Tool approval

Attach a pending decision above the editor. Deny and Allow once resolve the caller-owned approval state.

Save weekly update?docs/weekly-update.md

Attachment-only

Submit a ready file when the text draft is empty.

receipt.pdf

Sending

Send a request in a conversation. Its acknowledgement completes automatically, while edits to a newer draft stay in the composer.

Stop stream

Show a partial assistant response while it generates. Stop ends the response and keeps the text already received.

Check whether this receipt matches the original order.
I found the receipt. I’m checking the delivery details…

Failed send and retry

Keep the failed user message in the conversation, show a separate system notice, and retry from the message footer without sending a newer draft.

Check whether this receipt matches the original order.
The message could not be sent.

Disabled

Preserve the disabled draft while preventing edits and actions.

Long draft

Keep long content inside the autosizing field with internal scrolling at the maximum height.

Field label

Place the caller-owned Field.Label at the top of the primary composer panel. Field.Control connects it to the native textarea.

Describe what you need.

Read-only

Keep an archived draft readable while preventing changes and sending.

Blocked attachment

Keep a failed file visible and prevent sending until the caller removes or replaces it.

receipt.pdf
Remove the failed receipt before sending.

API reference