AI Prompt Input
The composer: auto-growing textarea, send-on-Enter, and a send/stop control.
- AI
- 1 file
- No extra npm packages
- Accessibility notes
pnpm dlx @dowel-ui/cli add ai-prompt-inputNo npm packages are needed beyond what Dowel already requires.
import { PromptInput } from "@/components/ui/ai-prompt-input";Default
Busy
With Model And Counter
Disabled
Send Stop Morph
Counter Reveal
<PromptInput>
| Prop | Type | Default |
|---|---|---|
busyA response is in flight: submission is blocked and Stop is shown instead. | boolean | false |
disabledBlocks submission and dims the composer. | boolean | false |
onSubmit | (event: FormEvent<HTMLFormElement>) => void | — |
Plus every attribute of <form> except onSubmit.
<PromptInputTextarea>
| Prop | Type | Default |
|---|---|---|
maxRows | number | DEFAULT_MAX_ROWS |
submitOnEnterSend on Enter, newline on Shift+Enter. Turn it off for a composer where Enter should always insert a newline and sending is only ever an explicit button press. | boolean | true |
Plus every attribute of <textarea> except rows.
<PromptInputToolbar>
Plus every attribute of <div>.
<PromptInputSubmit>
| Prop | Type | Default |
|---|---|---|
labelLabel while idle. | string | "Send message" |
onStopCalled instead of submitting when busy. | () => void | — |
stopLabelLabel while a response is streaming. | string | "Stop generating" |
Plus every attribute of <button>.
<PromptInputCounter>
| Prop | Type | Default |
|---|---|---|
max (required) | number | — |
value (required) | number | — |
warnAtFraction of the limit past which the counter starts warning. | number | 0.9 |
Plus every attribute of <div>.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes