ham7a311

Ask Bar

AI chats

About

A full-screen chat composer bar with a greeting, an auto-growing textarea, file/photo attachment menu, model picker, voice dictation and a word-by-word streaming reply log.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Ask Bar to your project and fits it to your theme.

Code

How Ask Bar is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";
import { AskBar, type AskModel } from "@/components/ui/ask-bar";

const MODELS: AskModel[] = [
  {
    id: "swift",
    name: "Swift",
    detail: "Quick answers for everyday questions",
  },
  {
    id: "deep",
    name: "Deep",
    detail: "Slower, thinks through harder problems",
  },
  {
    id: "scholar",
    name: "Scholar",
    detail: "Reads widely and cites its sources",
  },
];

// A fictional assistant: canned replies so the demo works offline, with no external calls.
function respond(prompt: string, model: AskModel) {
  const p = prompt.toLowerCase();
  if (p.includes("muscat") || p.includes("weekend"))
    return "Here's a gentle weekend in Muscat:\n\nSaturday morning, walk the Mutrah corniche before the heat, then the souq for frankincense. Lunch by the water, a rest, and a dhow out at sunset.\n\nSunday, an early drive to Wadi Shab, the swim to the hidden cave, and back for dinner in Qurum.";
  if (model.id === "deep")
    return `Let's take this step by step.\n\nFirst, what you're really asking: "${prompt}". Then the parts we know, the parts we can check, and the one decision that matters most. Tell me which you'd like to start with.`;
  if (model.id === "scholar")
    return `A careful answer would draw on a few good sources. On "${prompt}", I'd start with the most recent overview, compare two primary accounts, and note where they disagree, with each claim linked so you can check it.`;
  return `Good question. In short: start small, write down what you learn, and check it against one real example. Want me to go deeper on "${prompt}"?`;
}

export default function AskBarDarkDemo() {
  return (
    <div className="flex w-full h-screen">
      <AskBar
        className="w-full"
        greeting="What shall we look into today?"
        placeholder="Ask Qalam"
        models={MODELS}
        respond={respond}
        theme="dark"
      />
    </div>
  );
}

More by ham7a311

View all
  • Route Globe

    Route Globe

    6
  • Time Window

    Time Window

    4
  • Ruler Picker

    Ruler Picker

    4
  • Wave Mesh

    Wave Mesh

    4
  • Second Draft Text

    Second Draft Text

    3
  • Uptime Ribbon

    Uptime Ribbon

    3
  • Glass Carousel

    Glass Carousel

    3
  • Liquid Chrome

    Liquid Chrome

    3

More in AI chats

View all
  • AI Actions

    AI Actions

    317
  • Agent Chat

    Agent Chat

    17
  • Approval Card

    Approval Card

    12
  • Color Picker

    Color Picker

    73
  • Message

    Message

    48
  • AI Prompt Composer with Model Selector

    AI Prompt Composer with Model Selector

    24
  • AI Task List

    AI Task List

    158
  • Modal Card

    Modal Card

    98