About
AI composer with @ sources, / commands, a model picker with status dot, dictation, attachments, a focus ring and a rainbow WebGL sweep on model upgrade. Sources, commands and models via props; shadcn theme variables.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Prompt Bar to your project and fits it to your theme.
Code
How Prompt Bar is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import PromptBar, { Icon, type PromptCommand, type PromptDemoStep, type PromptModel, type PromptSource } from "@/components/ui/prompt-bar";
/* all content comes from here; the component only renders what it is given */
const SOURCES: PromptSource[] = [
{ key: "attach", name: "Add photos & files", desc: "Upload from your computer", attach: true, icon: <Icon><path d="m21.4 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" /></Icon> },
{ key: "sales", name: "Sales data", desc: "Revenue & churn metrics", icon: <Icon><path d="M4 20V10M10 20V4M16 20v-7M22 20H2" /></Icon> },
{ key: "catalog", name: "Product catalog", desc: "26 items, tags, links", icon: <Icon><g><path d="M12 2 2 7l10 5 10-5-10-5z" /><path d="M2 17l10 5 10-5M2 12l10 5 10-5" /></g></Icon> },
{ key: "web", name: "Web search", desc: "Real-time news and info", icon: <Icon><g><circle cx="12" cy="12" r="10" /><path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" /></g></Icon> },
{ key: "design", name: "Design files", desc: "Design-to-code workflows", icon: <Icon><g><rect x="3" y="3" width="8" height="8" rx="2" /><rect x="13" y="3" width="8" height="8" rx="2" /><rect x="3" y="13" width="8" height="8" rx="2" /><circle cx="17" cy="17" r="4" /></g></Icon> },
{ key: "chat", name: "Team chat", desc: "Read and manage channels", icon: <Icon><path d="M21 12a8 8 0 0 1-11.6 7.1L4 21l1.9-5.4A8 8 0 1 1 21 12z" /></Icon> },
{ key: "mail", name: "Mailbox", desc: "Read and manage email", connect: true, icon: <Icon><g><rect x="3" y="5" width="18" height="14" rx="2" /><path d="m3 7 9 6 9-6" /></g></Icon> },
];
const COMMANDS: PromptCommand[] = [
{ key: "compare", name: "/compare", desc: "This month vs last month" },
{ key: "plan", name: "/plan", desc: "Draft a weekly plan" },
{ key: "restock", name: "/restock", desc: "Build a reorder list" },
{ key: "draft-email", name: "/draft-email", desc: "Write a supplier email" },
{ key: "summarize", name: "/summarize", desc: "Digest the thread so far" },
];
const MODELS: PromptModel[] = [
{ key: "basic", name: "Swift 1", tag: "Basic", dot: "var(--color-primary, #3b82f6)" },
{ key: "flagship", name: "Aurora 5", tag: "Flagship", dot: "conic-gradient(from 0deg, #FF3D7F, #FF7A1A, #FFD600, #C2FF3D, #1FC8FF, #2E70FF, #D33CFF, #FF3D7F)", celebrate: true },
{ key: "legacy", name: "Ember 0.4", tag: "Legacy", dot: "var(--color-muted-foreground, #9ca3af)" },
];
/* walk the @ menu, then the / menu, then upgrade the model; any interaction stops it */
const STEPS: PromptDemoStep[] = [
{ draft: "", connect: false, model: "basic", hold: 1100 },
{ draft: "@", active: 0, hold: 900 },
{ draft: "@", active: 1, hold: 620 },
{ draft: "@", active: 4, hold: 620 },
{ draft: "@", active: 6, hold: 700 },
{ draft: "@", active: 6, connect: true, hold: 1000 },
{ draft: "", hold: 700 },
{ draft: "/", active: 0, hold: 900 },
{ draft: "/", active: 1, hold: 620 },
{ draft: "/", active: 3, hold: 1000 },
{ draft: "", hold: 800 },
{ draft: "", modelOpen: true, hold: 1200 },
{ draft: "", model: "flagship", hold: 2400 },
{ draft: "", hold: 900 },
];
export default function PromptBarDemo() {
return (
<div className="flex items-center justify-center bg-background p-8 text-foreground">
<PromptBar
sources={SOURCES}
commands={COMMANDS}
models={MODELS}
files={["chart.png", "menu.pdf", "export.csv"]}
dictationText="Compare weekend sales to last summer"
demoSteps={STEPS}
onSend={(text) => console.log("send:", text)}
/>
</div>
);
}
















