Prompt Input
ProNewAn AI composer with a model picker, tool switches, starter prompts, files by drop or paste, and a send button that turns into stop.
Installation
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
Props
| Prop | Type | Default |
|---|---|---|
| onSubmit* | (prompt: string, files: File[], options: { model?: string; tools: string[] }) => voidCalled with the trimmed prompt, any attached files, and the model and tools in effect. | — |
| onStop | () => voidCalled when the stop button is pressed while `loading`. | — |
| loading | booleanShows the stop button and disables sending. | false |
| placeholder | string | "Ask anything…" |
| maxHeight | numberTallest the textarea may grow, in pixels. | 200 |
| attachments | booleanAllow attaching files with the button, by dropping them, or by pasting. | true |
| models | PromptModel[]Models offered in the picker. Leave out to hide it. | — |
| model | stringSelected model id. Uncontrolled when omitted, starting at the first model. | — |
| onModelChange | (id: string) => void | — |
| tools | PromptTool[]Switches such as web search or extended thinking, shown beside the attach button. | — |
| defaultTools | string[]Tool ids switched on at first render. | [] |
| suggestions | string[]Starter prompts shown while the field is empty. Choosing one fills the field. | — |
| toolbar | React.ReactNodeExtra controls rendered in the bottom-left. | — |
| className | string | — |
Accessibility
- Enter sends, Shift+Enter adds a line, IME composition is respected.
- The model picker is a menu of radio items with arrow keys and typeahead; tool switches report their pressed state.
- Send and stop have distinct labels, and attached files are a labelled list with remove buttons.
- Starter prompts hide without moving the composer and leave the tab order while hidden.