Arihant jain

Streaming Text

AI chats 14

About

A streaming AI answer display that types out text with a blinking caret, inline numbered citations, source list, and clickable follow-up prompt suggestions.

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

Code

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

Usage.tsx

import { StreamingText } from "@/components/ui/streaming-text";

export default function StreamingTextDemo() {
  return (
    <div className="flex w-full items-center justify-center p-10">
      <StreamingText
        text="**Retrieval-augmented generation** combines a language model with an external knowledge source. [1] The model retrieves relevant documents at query time and conditions its answer on them, which reduces hallucinations and keeps responses grounded. [2]"
        streaming={false}
        citations={[
          {
            id: "c1",
            index: 1,
            url: "https://arxiv.org/abs/2005.11401",
            title: "RAG paper",
          },
          {
            id: "c2",
            index: 2,
            url: "https://www.pinecone.io/learn/retrieval-augmented-generation/",
            title: "Pinecone: RAG guide",
          },
        ]}
        followUps={[
          { id: "f1", label: "How does retrieval scoring work?" },
          { id: "f2", label: "Compare RAG vs fine-tuning" },
        ]}
        onFollowUp={(prompt) => console.log(prompt)}
      />
    </div>
  );
}

Dependencies

More by Arihant jain

View all
  • Footer section

    Footer section

    1.9K
  • Multistep Form

    Multistep Form

    710
  • Animated Drawer

    Animated Drawer

    694
  • Status Badge

    Status Badge

    513
  • Stacked Circular Footer

    Stacked Circular Footer

    426
  • Input Modal

    Input Modal

    329
  • Large Name Footer

    Large Name Footer

    199
  • Profile Dropdown

    Profile Dropdown

    196

More in AI chats

View all
  • AI Actions

    AI Actions

    326
  • Agent Chat

    Agent Chat

    18
  • Message Thread

    Message Thread

    45
  • Attachments

    Attachments

    22
  • Color Picker

    Color Picker

    110
  • Environment Variables

    Environment Variables

    14
  • System Message

    System Message

    58
  • AI Diff

    AI Diff

    74

Explore more

Part of Spectrum UI — browse the full library on 21st.dev.