AI Prompt Input
The composer of an AI product: a growing textarea, attachment chips that pop in, a model pill, and a send button that morphs into a stop square while the answer streams. Enter sends, Shift+Enter breaks a line.
- Category: Inputs
- Licence: Charcoal UI Pro
- Built with: React 19, Tailwind CSS 4, Motion
- Dependencies: motion, clsx, tailwind-merge
Examples
AI Prompt Input
Send a message to watch the button become a stop button for a moment.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | |
defaultValue | string | — | |
onValueChange | (value: string) => void | — | |
onSubmit | (value: string, attachments) => void | — | |
onStop | () => void | — | |
generating | boolean | false | |
models | string[] | — | |
model | string | — | |
onModelChange | (model: string) => void | — | |
placeholder | string | "Ask anything…" | |
maxRows | number | 6 | |
attachments | { id: string; name: string; kind?: string }[] | — | |
onAttach | () => void | — | |
onRemoveAttachment | (id: string) => void | — | |
className | string | — |
About AI Prompt Input
AI Prompt Input is the composer every AI product needs. The field grows with the message, attachments pop in as chips, a pill picks the model, and the send button morphs into a stop square while the answer streams.
AI Prompt Input is an input component for React 19, styled with Tailwind CSS 4 and animated with Motion. It drops into Next.js, Vite, Remix or Astro through the shadcn CLI as a single file you own.
When to use AI Prompt Input
- Chat interfaces for AI assistants and copilots.
- Prompt boxes in generative tools.
- Support chat with file attachments.
- Search that answers in natural language.
How it works
Enter sends and Shift+Enter breaks a line, with IME composition respected. Height is measured up to maxRows, the send and stop states share one button so focus never jumps, and Escape stops generation.
It is a real form control: it has an accessible name, works with the keyboard alone, shows a visible focus ring and announces its state to screen readers. With prefers-reduced-motion on, it holds still or settles instantly instead of animating.
Customizing AI Prompt Input
Every prop is documented in the API reference above with its type and default. The ones you will reach for first are listed here.
The Customize panel next to the preview lets you change placeholder, maxRows live, and the Code tab updates to match, so the snippet you copy already carries your values.
- value (string).
- defaultValue (string).
- generating (boolean, default false).
- models (string[]).
- model (string).
- placeholder (string, default "Ask anything…").
The example on this page
- AI Prompt Input: Send a message to watch the button become a stop button for a moment.
Goes well with AI Prompt Input
These inputs pieces share its tokens and motion language, so they sit together on one page without clashing.
- Magnetic: Make any React element lean toward the pointer and spring home: a magnetic hover in one wrapper
- Color Picker: An animated React swatch colour picker with a ring that glides to the selection
- Rating: An animated React star rating with hover preview and a ripple of popping stars
- File Dropzone: An animated React file dropzone that lifts on hover and lists uploads with progress
- Like Button: An animated React like button: the heart pops, sparks burst and the count rolls
Install AI Prompt Input
npx shadcn@latest add @charcoal/ai-prompt-inputAI Prompt Input is part of Charcoal UI Pro. One seat unlocks all 300 Pro components, 107 landing-page sections and 100 full templates, for every personal and client project, with updates included. Add the @charcoal registry once with your access token, then the command above copies ai-prompt-input.tsx into components/ui and installs clsx, tailwind-merge.
You own the file you install: no runtime package, no lock-in, nothing to keep in sync. Change it however your product needs.
See Charcoal UI Pro pricing · Pro setup
Frequently asked questions
- Does it connect to an AI API?
- It is the input only: onSubmit gives you the text and attachments, and the generating prop switches it to the stop state while your stream runs, so it works with any model or SDK.
- How do I install AI Prompt Input?
- AI Prompt Input is part of Charcoal UI Pro. Add the @charcoal registry to components.json with your access token, then run npx shadcn@latest add @charcoal/ai-prompt-input. It copies ai-prompt-input.tsx into components/ui and installs motion, clsx, tailwind-merge.
- Is AI Prompt Input free for commercial use?
- AI Prompt Input needs a Charcoal UI Pro seat, monthly or a one-time lifetime price. A seat covers unlimited personal and commercial projects, including client work, and every future Pro component.
- Does AI Prompt Input work with Next.js?
- Yes. It is a client component for React 19 styled with Tailwind CSS 4, so it works in the Next.js App Router and Pages Router, Vite, Remix and Astro.
- Can an AI coding agent install AI Prompt Input?
- Yes. Connect the Charcoal UI MCP server (https://charcoalui.com/mcp) to Claude Code, Cursor or any MCP client; get_component returns AI Prompt Input's props and get_install_command returns the exact command.