ham7a311

Stream Reply

AI chats 8

About

An AI chat assistant reply that streams in token by token with blur-in word animation, syntax-highlighted code typing, a glowing caret, and stop/regenerate controls.

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

Code

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

Usage.tsx

"use client";

import { StreamReply, type Block } from "@/components/ui/stream-reply";

const BLOCKS: Block[] = [
  {
    type: "p",
    text: "Yes — debounce the search input so you only query after the user pauses. 250ms is a good start for a destination search like this:",
  },
  {
    type: "code",
    lang: "ts",
    code: [
      { t: "export function ", k: "kw" },
      { t: "useDebounced", k: "fn" },
      { t: "<T>(value: T, ms = " },
      { t: "250", k: "num" },
      { t: ") {\n  " },
      { t: "const ", k: "kw" },
      { t: "[v, setV] = " },
      { t: "useState", k: "fn" },
      { t: "(value);\n  " },
      { t: "useEffect", k: "fn" },
      { t: "(() => {\n    " },
      { t: "const ", k: "kw" },
      { t: "id = " },
      { t: "setTimeout", k: "fn" },
      { t: "(() => setV(value), ms);\n    " },
      { t: "return ", k: "kw" },
      { t: "() => " },
      { t: "clearTimeout", k: "fn" },
      { t: "(id);\n  }, [value, ms]);\n  " },
      { t: "return ", k: "kw" },
      { t: "v;\n}" },
    ],
  },
  {
    type: "list",
    items: [
      "Show the spinner only after 300ms, so fast answers never flash it.",
      "Keep the last results on screen while the next ones load.",
      "Cancel the previous request with an AbortController.",
    ],
  },
];

export default function Demo() {
  return (
    <div className="flex min-h-screen w-full items-center justify-center p-6 bg-background text-foreground">
      <StreamReply
        theme="paper"
        question="Should I debounce the destination search box?"
        blocks={BLOCKS}
      />
    </div>
  );
}

More by ham7a311

View all
  • Wave Mesh

    Wave Mesh

    141
  • Route Globe

    Route Globe

    130
  • Glass Tiles

    Glass Tiles

    112
  • Glyph Swell

    Glyph Swell

    51
  • Orbit Ring Stats

    Orbit Ring Stats

    48
  • Ask Bar

    Ask Bar

    39
  • Intent Label

    Intent Label

    33
  • Glass Ribbons

    Glass Ribbons

    30

More in AI chats

View all
  • AI Actions

    AI Actions

    338
  • Illos Knowledge Sources

    Illos Knowledge Sources

    37
  • Aquarium Prompt

    Aquarium Prompt

    42
  • Attachments

    Attachments

    37
  • Color Picker

    Color Picker

    167
  • Commit

    Commit

    30
  • AI Suggestions

    AI Suggestions

    20
  • Chat Bubble

    Chat Bubble

    198