Message Scroller
Message Scroller coordinates a bounded transcript and optional following behavior.
Practical React example
Keep a streaming conversation near its newest output while allowing someone to read older messages.
Before you copy and paste
Keep the example in the React rendering environment required by the imported component. Copy components/agents/message-scroller.tsx and its returned support files from the Code tab; preserve the project-relative paths.
Listed package dependencies: clsx, lucide-react, motion, react, react-dom, tailwind-merge.
Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.
Keep a streaming conversation near its newest output while allowing someone to read older messages
// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";
import {
ChatPreview,
type ChatPreviewMessage,
} from "@/components/previews/agents/chat-preview";
const MESSAGES: ChatPreviewMessage[] = [
{
id: "scope-question",
from: "user",
content: "What should the first release include?",
},
{
id: "scope-answer",
from: "assistant",
content: "Start with the smallest workflow that still feels complete.",
},
{
id: "states-question",
from: "user",
content: "Include streaming and recovery states too.",
},
{
id: "states-answer",
from: "assistant",
content: "Yes. Those states make the first version feel dependable.",
},
{
id: "evidence-question",
from: "user",
content: "How should we present tool results?",
},
{
id: "evidence-answer",
from: "assistant",
content: "Keep results close to the action that produced them.",
},
{
id: "approval-question",
from: "user",
content: "What about actions that need confirmation?",
},
{
id: "approval-answer",
from: "assistant",
content: "Pause the run, explain the impact, and ask before continuing.",
},
{
id: "summary-question",
from: "user",
content: "Can the transcript stay easy to navigate?",
},
{
id: "summary-answer",
from: "assistant",
content: "Use the rail to jump between turns without losing your place.",
},
];
export function MessageScrollerPreview() {
return (
<ChatPreview
initialMessages={MESSAGES}
showRail
reply="The viewport follows while you stay at the live edge. Scroll upward while this response streams and it will leave your reading position alone."
placeholder="Send another message…"
/>
);
}
Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.
Give the viewport a real height. Respect the reader leaving the live edge and use onFollowChange to offer a return-to-latest action when appropriate.
Customization
- MessageScrollerProps.followOutput
- Optional; boolean. Keep streamed output pinned while the reader remains near the end.
- MessageScrollerProps.followThreshold
- Optional; number. Distance from the end that still counts as following the output.
- MessageScrollerProps.smooth
- Optional; boolean. Smoothly follow growing content.
- MessageScrollerProps.onFollowChange
- Optional; (following: boolean) => void. Reports when the reader leaves or returns to the live edge.
- MessageScrollerProps.label
- Optional; string. Accessible label for the scrollable transcript.
- MessageScrollerProps.busy
- Optional; boolean. Marks the transcript as waiting for more streamed content.
- MessageScrollerProps.navigation
- Optional; "rail". Adds a compact rail for navigating between rendered Message rows.
- MessageScrollerProps.navigationLabel
- Optional; string. Accessible label for the optional message navigation rail.
- MessageScrollerProps.viewportClassName
- Optional; string.
- MessageScrollerProps.contentClassName
- Optional; string.
- MessageScrollerProps.railClassName
- Optional; string.
- MessageScrollerProps.viewportRef
- Optional; Ref<HTMLElement>.
- MessageScrollerProps.viewportProps
- Optional; Omit< ComponentPropsWithRef<"section">, "children" | "className" | "ref" >.
- MessageScrollerProps.contentProps
- Optional; Omit< ComponentPropsWithRef<"div">, "children" | "className" | "ref" >.
Integration notes
- Do not force-scroll back to the end while someone selects or reads earlier content.
- Avoid duplicate announcements when both the transcript and an individual response use live regions.
Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.
Give your agent taste.
The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.
All components are free. Sign up only to connect MCP.