AI chat
An answer written in small, uneven text chunks.
Motion for streamed responses
Answers, diagrams and the moments in between.
One response, arriving a little at a time.
An answer written in small, uneven text chunks.
Tables, task lists, emphasis and links take shape from incoming Markdown.
A streamed image reference resolves into a visual inside the answer.
Data points arrive individually and the chart builds in the response.
A streamed reasoning summary, then the answer. Open or close the summary at any time.
Provide a sample file, answer a question, approve or decline, then inspect a streamed change preview.
Mermaid source streams into a code fence. Once complete, it resolves into a real SVG diagram.
A code fence becomes a growing code block, followed by an explanation.
Chunks arrive. Your renderer gives them structure. Motion connects each moment to the next. Explore the layers, then replay a little piece of the stream.
These demos use the published package plus a small showcase renderer for Markdown, requests, file previews and diagrams. App logic owns the choices; motion owns the transitions. Mermaid loads only for a complete diagram. The rich renderer is a website prototype.
An answer arrives in pieces. Keep the stream independent of how you display it.
// SSE, fetch, or any async iterator.
for await (const chunk of incomingStream) {
renderer.append(chunk);
}
// A chunk can end anywhere:
// "An an" → "swer, " → "taking shape."const answer = document.createElement("p");
answer.dataset.streamMorphKey = "answer";
response.append(answer);
for await (const chunk of incomingStream) {
// Keep the existing document connected.
answer.append(chunk);
}import { createStreamMorph } from "stream-morph";
const text = createStreamMorph(response, {
duration: 180,
enterDuration: 240,
});
for await (const chunk of incomingStream) {
text.write(chunk);
}
text.finish();Building your own response? See the imports and usage guide →
Edit the Markdown, style the response and tune the stream.