Arihant jain

Streaming Text

AI chats 12

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

    698
  • Animated Drawer

    Animated Drawer

    686
  • Status Badge

    Status Badge

    495
  • Stacked Circular Footer

    Stacked Circular Footer

    413
  • Input Modal

    Input Modal

    316
  • Large Name Footer

    Large Name Footer

    193
  • Profile Dropdown

    Profile Dropdown

    187

More in AI chats

View all
  • AI Actions

    AI Actions

    319
  • Agent Chat

    Agent Chat

    17
  • System Message

    System Message

    54
  • Message Thread

    Message Thread

    35
  • Color Picker

    Color Picker

    81
  • AI Task List

    AI Task List

    160
  • Modal Card

    Modal Card

    101
  • Quota Banner

    Quota Banner

    21

Explore more

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