
AI · Free
AI prompt bar
A prompt bar with attachments, a model menu, a thinking shimmer and a streamed answer. Optional Bot.
Free on Gumroad: the download arrives in your inbox.
Details
- Category
- AI
- Plan
- Free
- Code
- React + Tailwind, TypeScript · 480 lines
- Files
- PromptBar.tsx, route.ts
- Needs
- The Bot (installed with it), @anthropic-ai/sdk
- Agents
- MCP server and shadcn registry
About
A chat input for AI products. It grows as you write, takes files (button or drag and drop), lets you pick a model, shows a "thinking" shimmer and streams the answer in word by word. While it answers, Send becomes Stop. The Bot (Kit 01) can sit beside it as the assistant's face. React + Tailwind, no other libraries.
Install
With the shadcn CLI:
npx shadcn@latest add https://www.stackd.codes/r/prompt-bar.jsonOr let your agent add it through the StackD MCP server:
claude mcp add --transport http stackd https://www.stackd.codes/mcpPrompt for your agent
Paste it into Claude Code, Cursor, Codex or VS Code once the MCP server is connected.
Add the StackD AI prompt bar component to this project. Use the StackD MCP server: call get_component with { "name": "prompt-bar" }, write the files at the paths it gives and install any npm packages it lists. Then use it where it fits, following its README for the props, and keep its own styles.Files
PromptBar.tsx: the barBot.tsx: the bot (only needed if you usebot)app/api/chat/route.ts: a ready route for Next.js that streams Claude's answer
Put PromptBar.tsx and Bot.tsx in the same folder (for example components/).
Tailwind
Add the shimmer animation to tailwind.config:
theme: {
extend: {
colors: { ink: '#111111', paper: '#FFFFFF' },
keyframes: { shimmer: { from: { backgroundPosition: '100% 0' }, to: { backgroundPosition: '-100% 0' } } },
animation: { shimmer: 'shimmer 1.6s linear infinite' },
},
},Use
import { PromptBar } from './components/PromptBar'
<PromptBar /> // demo answers, to try it
<PromptBar bot /> // with the Bot
<PromptBar bot={{ shape: 'arch', color: '#901919' }} onSend={yourAI} />Connect your AI
The bar has no AI of its own. onSend gets the text, the files, the chosen model and a signal for Stop. Return the full answer as a string, or stream it as text chunks.
With the route in this pack (Next.js):
<PromptBar
bot
models={['Fast', 'Smart', 'Deep']}
onSend={async function* (prompt, { model, signal }) {
const res = await fetch('/api/chat', { method: 'POST', body: JSON.stringify({ prompt, model }), signal })
const reader = res.body!.getReader()
const decoder = new TextDecoder()
while (true) {
const { done, value } = await reader.read()
if (done) break
yield decoder.decode(value)
}
}}
/>
Then npm install @anthropic-ai/sdk and put ANTHROPIC_API_KEY=... in your .env. Your key stays on the server. To use another provider (OpenAI, Gemini, your own model), change only the route: the bar stays the same.
Without streaming:
<PromptBar onSend={async (prompt) => (await fetch('/api/ask', { method: 'POST', body: prompt })).text()} />Options
| Prop | Default | What it does |
|---|---|---|
onSend | demo answers | Your AI: (prompt, { files, model, signal }), returns a string or streams text |
models | ['Fast', 'Smart', 'Deep'] | The names in the model menu |
placeholder | 'Ask anything' | Text in the empty field |
bot | off | true, or the Bot's options: shape, eyes, color, eyeColor |
compact | false | A small version: no attachments or model menu, shorter conversation |
Enter sends, Shift+Enter adds a new line. Up to 6 files at a time.
Licence
You can use it in personal and commercial projects. Don't resell or share the component on its own.
Made by StackD · stackd.codes

