PromptInput

Multi-line, auto-expanding text input for AI chat interfaces. Includes attachment support, keyboard shortcuts, and smooth height animation.

Preview

With attachments

Users can attach images, PDFs, or other files. Attachments appear as removable previews above the input.

Loading

Disable the input and show a spinner while the AI is generating a response.

Implementation

Internally uses a textarea with JavaScript-driven height calculation. Enter submits; Shift+Enter inserts a newline.

PropTypeDefaultDescription
onSubmit(value: string, attachments?: Attachment[]) => voidCallback with entered text and optional attachments.
placeholderstring"Type a message..."Placeholder when input is empty.
disabledbooleanfalseDisables input and send button.
loadingbooleanfalseShows loading spinner on send button.
maxLinesnumber6Maximum height in lines before scrolling.
valuestringControlled input value.
onChange(value: string) => voidChange callback for controlled usage.
acceptstring"image/*,.pdf,.txt,.md,.json"Accepted file types for attachments.
maxAttachmentsnumber5Maximum number of attachments allowed.

Props

PropTypeDefaultDescription
onSubmit(value: string, attachments?: Attachment[]) => voidCallback with entered text and optional attachments.
placeholderstring"Type a message..."Placeholder when input is empty.
disabledbooleanfalseDisables input and send button.
loadingbooleanfalseShows loading spinner on send button.
maxLinesnumber6Maximum height in lines before scrolling.
valuestringControlled input value.
onChange(value: string) => voidChange callback for controlled usage.
acceptstring"image/*,.pdf,.txt,.md,.json"Accepted file types for attachments.
maxAttachmentsnumber5Maximum number of attachments allowed.

Accessibility

  • Attachments have remove buttons with accessible labels.
  • Send button disabled when empty; enter key is the primary action.
  • No text contrast issues: input text uses --text-primary; placeholder uses --text-tertiary.