nyuchimzizi
Mzizi — an open-architecture project of the Bundu Foundation, operated and developed by Nyuchi. Built on the Five African Minerals palette.
Built by Nyuchi Africav4.0.39
Typewriter effect text renderer for streaming LLM output.
No interactive demo is registered for this component yet — the source is shown directly.
"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
function StreamingText({
className,
text,
speed = 20,
onComplete,
...props
}: React.ComponentProps<"span"> & {
text: string
speed?: number
onComplete?: () => void
}) {
const [displayed, setDisplayed] = React.useState("")
const [done, setDone] = React.useState(false)
React.useEffect(() => {
setDisplayed("")
setDone(false)
let index = 0
const interval = setInterval(() => {
index++
if (index >= text.length) {
setDisplayed(text)
setDone(true)
clearInterval(interval)
onComplete?.()
} else {
setDisplayed(text.slice(0, index))
}
}, speed)
return () => clearInterval(interval)
}, [text, speed, onComplete])
return (
<span
data-slot="streaming-text" data-portal="https://design.nyuchi.com/components/streaming-text"
data-complete={done}
className={cn("whitespace-pre-wrap", className)}
{...props}
>
{displayed}
{!done && (
<span className="streaming-cursor ml-0.5 inline-block h-[1.1em] w-0.5 translate-y-[0.15em] bg-foreground">
<style>{`
@keyframes cursor-blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
.streaming-cursor {
animation: cursor-blink 0.8s step-end infinite;
}
`}</style>
</span>
)}
</span>
)
}
export { StreamingText }
The variants, sizes, and props surfaced by the registry. Each is sourced from the Supabase component_docs table.
Hit the registry API live and see the JSON the shadcn CLI consumes when it installs this component.
/api/v1/ui/streaming-textnpx shadcn@latest add https://mzizi.dev/api/v1/ui/streaming-textcomponents/ui/streaming-text.tsx