Pedro

AI Response Stream

AI chats 1

About

Minimalist AI streaming response with collapsible reasoning, 3-image split gallery, lightbox, and feedback actions.

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

Code

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

Usage.tsx

import React, { useState } from "react";
import { AiResponseStream, AiSampleMedia } from "@/components/ui/ai-response-stream";

interface PromptPreset {
  id: string;
  label: string;
  prompt: string;
  intro: string;
  outro: string;
  media: AiSampleMedia[];
}

const PRESETS: PromptPreset[] = [
  {
    id: "architecture",
    label: "Architecture",
    prompt: "Design a minimalist glass pavilion surrounded by nature at twilight.",
    intro:
      "Here are three connected perspectives of the minimalist glass pavilion concept — covering the twilight exterior facade, the warm timber interior lounge, and the stone courtyard transition.",
    outro:
      "Click any frame to inspect it in full screen, or let me know if you want to adjust the lighting or materials.",
    media: [
      {
        id: "arch-1",
        imageUrl:
          "https://cdn.21st.dev/assets/mirror/89/89ae9d6a1b963aab297470ea90ec199c9c9d15ef659cb8d62bdc16cd8e2bea54.jpg",
        alt: "Minimalist glass and concrete pavilion exterior at twilight",
        caption: "01 • Exterior facade & reflection pool",
      },
      {
        id: "arch-2",
        imageUrl:
          "https://cdn.21st.dev/assets/mirror/33/3305fe3b3e365d9680e736745d5c62b5c57a97322a631dc616de0a186dfd4849.jpg",
        alt: "Warm minimalist living interior with timber ceiling and glass walls",
        caption: "02 • Interior living lounge",
      },
      {
        id: "arch-3",
        imageUrl:
          "https://cdn.21st.dev/assets/mirror/a8/a813be13bfe462dbe2a9d69ccc858bfb48b912fbb90a7e8b054e307220606587.jpg",
        alt: "Architectural concrete and stone courtyard detail in soft natural light",
        caption: "03 • Courtyard material detail",
      },
    ],
  },
  {
    id: "workspace",
    label: "Studio",
    prompt: "Show 3 minimal workspace setups with natural light and clean hardware.",
    intro:
      "Here is a 3-frame layout comparing natural oak desk surfaces, matte aluminum displays, and warm ambient task lighting.",
    outro:
      "Select any image to cycle through the full-resolution gallery.",
    media: [
      {
        id: "work-1",
        imageUrl:
          "https://cdn.21st.dev/assets/mirror/32/32ec339fb16e4bdafe1b748914255556ae17ae56cba7314adfb330c28d13346b.png",
        alt: "Minimalist laptop desk setup in morning sunlight",
        caption: "01 • Morning light desk",
      },
      {
        id: "work-2",
        imageUrl:
          "https://cdn.21st.dev/assets/mirror/b1/b1a18b93162fe8a983793435980ed55b9ba434a0b2cfe034bf192945b5dfbd51.jpg",
        alt: "Clean architectural studio table and chair",
        caption: "02 • Drafting table angle",
      },
      {
        id: "work-3",
        imageUrl:
          "https://cdn.21st.dev/assets/mirror/21/21e9e5baba2181b594ed013346ecc8b9dbaf41cbf83ff591812a3acb77dc7cec.jpg",
        alt: "Minimalist ceramic and notebook detail on wooden desk",
        caption: "03 • Tactile surface detail",
      },
    ],
  },
];

export function DemoOne() {
  const [selectedId, setSelectedId] = useState<string>("architecture");
  const current = PRESETS.find((p) => p.id === selectedId) ?? PRESETS[0];

  return (
    <div className="flex min-h-[640px] w-full flex-col items-center justify-center bg-white px-4 py-10 text-zinc-950 sm:px-8 dark:bg-[#09090B] dark:text-zinc-50">
      {/* Subtle Prompt Switcher */}
      <div className="mb-8 inline-flex items-center gap-1 rounded-full border border-zinc-200 bg-zinc-100/80 p-1 dark:border-white/10 dark:bg-zinc-900">
        {PRESETS.map((preset) => (
          <button
            key={preset.id}
            type="button"
            onClick={() => setSelectedId(preset.id)}
            className={`cursor-pointer rounded-full px-3.5 py-1 text-xs font-semibold transition ${
              selectedId === preset.id
                ? "bg-white text-zinc-950 shadow-xs dark:bg-zinc-800 dark:text-white"
                : "text-zinc-600 hover:text-zinc-950 dark:text-zinc-400 dark:hover:text-white"
            }`}
          >
            {preset.label}
          </button>
        ))}
      </div>

      <AiResponseStream
        key={current.id}
        userPrompt={current.prompt}
        introText={current.intro}
        outroText={current.outro}
        media={current.media}
      />
    </div>
  );
}

export default DemoOne;

More by Pedro

View all
  • Liquid Glass Tab Bar

    Liquid Glass Tab Bar

    91
  • Liquid Glass Theme Toggle

    Liquid Glass Theme Toggle

    43
  • Liquid Glass Viewport Toggle

    Liquid Glass Viewport Toggle

    16
  • Liquid Glass Pricing

    Liquid Glass Pricing

    12
  • Liquid Glass Button

    Liquid Glass Button

    12
  • Liquid Glass Toggle Switch

    Liquid Glass Toggle Switch

    10
  • Edge Cluster Status Card

    Edge Cluster Status Card

    7
  • Command Search Input

    Command Search Input

    4

More in AI chats

View all
  • AI Actions

    AI Actions

    369
  • Agent Chat

    Agent Chat

    21
  • Aquarium Prompt

    Aquarium Prompt

    189
  • AI Suggestions

    AI Suggestions

    24
  • AI Artifact

    AI Artifact

    17
  • AI Orb

    AI Orb

    228
  • Commit

    Commit

    45
  • Interactive LLM Token & Context Window Visualizer

    Interactive LLM Token & Context Window Visualizer

    13