Streaming Code Block
Generated code arrives line by line while the panel grows downward to fit it.
The animated component in this preview is rendered from the canonical file shown here. The surrounding demo shell only provides context and is not part of the copied code.
import { useEffect, useState } from "react";
import { motion, useReducedMotion } from "motion/react";
/**
* Vibary · Streaming Code Block
*
* A generated snippet arriving line by line. The panel grows downward to
* fit each new line, so the content already on screen never shifts andAbout this pattern
The panel a model fills in while it writes code. Each line resolves in place with a hair of rise, and the block's height eases open by exactly one line as it lands — so everything above stays where the reader left it and the page never scrolls out from under them. A caret rides the newest line, the gutter numbers keep count, and the footer changes from generating to generated when the last line arrives. Nothing springs: a panel that overshoots its own height jolts every line already on screen.
Where it shows up
Screens we drew to show where this motion usually sits. Illustrations, not captures of any product.
- AI assistant
Fenced code answers fill out downward while the reply stays anchored.
Related patterns
- Tool Call BadgeA badge announces the tool an agent is calling, turns while it runs, then settles into the result count.
- Progressive Image GenerationA generated picture resolves from blur to sharp across a few discrete refinement passes.
- Streaming Text RevealWords arrive one at a time behind a soft caret — the answer is being written, not loaded.