BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/simple-ai/markdown-streaming-demo

markdown-streaming-demo

simple-ai/markdown-streaming-demo
FreeExample

simple-ai publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by simple-ai on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://simple-ai.dev/r/markdown-streaming-demo.json

Source

./src/registry/examples/markdown-streaming-demo.tsxsimple-ai.dev/r/markdown-streaming-demo.json
1"use client";
2
3import { useEffect, useState } from "react";
4import { Button } from "@/components/ui/button";
5import { MarkdownContent } from "../ui/markdown-content";
6
7export default function MarkdownStreamingDemo() {
8 const [content, setContent] = useState("");
9 const [isStreaming, setIsStreaming] = useState(false);
10 const fullContent = `# The Lost Key
11## A Tale of Mystery
12
13* Sarah woke up to find her favorite golden key missing from its usual spot
14* She remembered using it last night to lock her diary
15* The search began:
16 * Under the bed - nothing but dust
17 * In her coat pockets - empty
18 * On her desk - just scattered papers
19
20> "Sometimes what we're looking for is right where we least expect it"
21
22* As she made her bed, something shiny caught her eye
23* The key had slipped between the pages of her book
24* With a smile, she realized she'd been using it as a bookmark
25
26*The End*`;
27
28 useEffect(() => {
29 // Typically you'd use a streaming API to get the content, this is just a demo
30 if (!isStreaming) {
31 return;
32 }
33
34 let currentIndex = 0;
35 const words = fullContent.split(" ");
36
37 const streamInterval = setInterval(() => {
38 if (currentIndex >= words.length) {
39 clearInterval(streamInterval);
40 setIsStreaming(false);
41 return;
42 }
43
44 const nextChunk = words.slice(0, currentIndex + 3).join(" ");
45 setContent(nextChunk);
46 currentIndex += 3;
47 }, 70);
48
49 return () => clearInterval(streamInterval);
50 }, [isStreaming]);
51
52 const handleStart = () => {
53 setContent("");
54 setIsStreaming(true);
55 };
56
57 return (
58 <div className="space-y-4 w-full max-h-[400px] overflow-y-auto">
59 <div className="flex gap-2">
60 <Button onClick={handleStart} disabled={isStreaming}>
61 {content ? "Restart" : "Start"} Streaming
62 </Button>
63 </div>
64 <div className="p-4 w-full min-h-[200px] border rounded-md overflow-y-auto">
65 <MarkdownContent content={content} />
66 </div>
67 </div>
68 );
69}

Files it writes

  • ./src/registry/examples/markdown-streaming-demo.tsx

Facts

Registry
simple-ai
Type
registry:example
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on simple-ai simple-ai.dev Alwurts/simple-ai on GitHub Raw registry item This item as JSON

More from simple-ai

All 77 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
chat-input-demo-mentionschat-input-demo-mentionssimple-aiExamplesFreeno deps
chat-input-demo-simplechat-input-demo-simplesimple-aiExamplesFreeno deps
chat-input-with-addonschat-input-with-addonssimple-aiExamplesFreeno deps
chat-message-area-demochat-message-area-demosimple-aiExamplesFreeno deps
chat-message-area-demo-alignmentchat-message-area-demo-alignmentsimple-aiExamplesFreeno deps
chat-message-area-demo-streamingchat-message-area-demo-streamingsimple-aiExamplesFreeno deps
chat-message-demochat-message-demosimple-aiExamplesFreeno deps
chat-message-demo-avatar-imagechat-message-demo-avatar-imagesimple-aiExamplesFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex