Streaming Response
Pass the growing Markdown string on every chunk. Half-written bold, an unclosed code fence and a table mid-row each render as what they are about to become, bursty chunks are metered into a steady pace, and each new word fades in behind a caret. No Markdown dependency.
Ready for AI tools one file typed props installs by name prompt included
The decision inside it
It reads Markdown that is not finished yet
A normal renderer shows raw asterisks and pipes until the closing mark arrives, then jumps. This one treats an opener with no closer as open to the end, so the text never redraws itself under the reader.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Layro's Streaming Response for this.
Install it: npx shadcn@latest add https://layropro.com/r/streaming-response
Import it from @/components/ui/streaming-response.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above.
API
“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Prop | Type | Notes |
|---|---|---|
textrequired | string | The answer so far, as Markdown. Pass the whole growing string on every chunk. |
streaming | boolean | True while more is coming. Shows the caret and fades new words in. |
smooth | boolean | Even out bursty chunks so the text arrives at a steady pace. Default true. |
animateWords | boolean | Fade each word in as it arrives. Default true. |
onSettled | () => void | Called once the last character is on screen: `streaming` is false and the pacing has caught up. |
onCopyCode | (code: string, language?: string) => void | Called with the code when a block's Copy is pressed. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLayro foundations, installed alongside it
layro-themebuttonLifetime access
Every component, and everything we ship next.
- All 112 components, source included
- The template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.
More in AI Chat
All AI Chat componentsThinking State
FreeThe wait before the first word: what it is doing, for how long, and the trail so far.
Message Actions
FreeCopy, regenerate and rate an answer, with every button confirming in place.
Prompt Input
FreeThe box you type in: grows with the text, Enter sends, and Send becomes Stop.
Chat Empty State
FreeThe screen before the first message: who is listening, what it knows, and what to ask.
Prompt Composer
PaidThe full input: attach files, pick a model, slash commands and @mentions.
Included with lifetime access
Suggested Prompts
PaidStarter questions as cards, chips or a list, with categories and a shuffle.
Included with lifetime access