Prompt Input
AI chat composer with attachments, toolbar slot and stop button.
Enter to send, Shift+Enter for a new line. Drop files to attach.
Installation
$ pnpm dlx shadcn@latest add @synccn/prompt-inputFirst time in this project? Connect synccn with one command.
Usage
import { PromptInput } from "@/components/ui/prompt-input";<PromptInput busy={busy} onSubmit={send} onStop={stop} />API reference
Generated from the component's TypeScript types, so it always matches the code.
PromptInput
Chat composer for AI products: auto-growing field, attachments, a model picker slot, Enter to send and a stop button while busy.
- onSubmit
(message: { text: string; files: File[] }) => voidCalled on send.
- onStop
() => voidCalled when stop is pressed while busy.
- busy
booleanDefault
falseSwaps send for stop while a response is generating.
- placeholder
stringDefault
"Ask anything…"Placeholder text.
- toolbar
React.ReactNodeExtra controls beside the attach button, e.g. a model picker.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for ArrowUp, FileText, Paperclip, Square, X
Keyboard
- EnterSend
- Shift+EnterNew line
Accessibility
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA attributes: aria-label
- Keys handled: Enter
- Includes text only screen readers hear