---
title: "Message Scroller | Free React & Tailwind Agents Component | Motion UI"
canonical: "https://blacknest.dev/motion/c/agents/message-scroller"
github_source: "https://github.com/Rkj0123/motion-ui-skill/blob/main/components/agents/message-scroller.tsx"
install_command: "npx motion-ui-skill add message-scroller"
dependencies: ["clsx","lucide-react","motion","react","react-dom","tailwind-merge"]
category: "agents"
subcategory: "agents"
---

# Message Scroller

> A reader-aware conversation viewport that follows streamed output at the live edge and releases control when the reader moves away.

## Install

```bash
npx motion-ui-skill add message-scroller
```

## Dependencies

- `clsx`
- `lucide-react`
- `motion`
- `react`
- `react-dom`
- `tailwind-merge`

## Usage

```tsx
"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…"
    />
  );
}
```

## API Reference

### MessageScroller

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `followOutput` | `boolean` | `true` | No | Keep streamed output pinned while the reader remains near the end. |
| `followThreshold` | `number` | `56` | No | Distance from the end that still counts as following the output. |
| `smooth` | `boolean` | `true` | No | Smoothly follow growing content. |
| `onFollowChange` | `((following: boolean) => void)` | — | No | Reports when the reader leaves or returns to the live edge. |
| `label` | `string` | `Conversation` | No | Accessible label for the scrollable transcript. |
| `busy` | `boolean` | — | No | Marks the transcript as waiting for more streamed content. |
| `navigation` | `"rail"` | — | No | Adds a compact rail for navigating between rendered Message rows. |
| `navigationLabel` | `string` | `Message navigation` | No | Accessible label for the optional message navigation rail. |
| `viewportClassName` | `string` | — | No | — |
| `contentClassName` | `string` | — | No | — |
| `railClassName` | `string` | — | No | — |
| `viewportRef` | `Ref<HTMLElement>` | — | No | — |
| `viewportProps` | `Omit<DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>, "ref" \| "className" \| "children">` | — | No | — |
| `contentProps` | `Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref" \| "className" \| "children">` | — | No | — |
| `className` | `string` | — | No | — |

## Source Files

- [components/agents/message-scroller.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/agents/message-scroller.tsx)
- [components/agents/agent-disclosure.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/agents/agent-disclosure.tsx)
- [components/agents/citations.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/agents/citations.tsx)
- [components/agents/message-bubble.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/agents/message-bubble.tsx)
- [components/agents/message-context.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/agents/message-context.tsx)
- [components/agents/message.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/agents/message.tsx)
- [components/agents/prompt-input.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/agents/prompt-input.tsx)
- [components/agents/streaming-response.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/agents/streaming-response.tsx)
- [components/motion/button/base.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/button/base.tsx)
- [components/motion/button/index.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/button/index.tsx)
- [components/motion/button/magnetic.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/button/magnetic.tsx)
- [components/motion/button/metallic.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/button/metallic.tsx)
- [components/motion/button/stateful.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/button/stateful.tsx)
- [components/motion/magnetic.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/magnetic.tsx)
- [components/motion/popover-morph.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/popover-morph.tsx)
- [components/motion/popover-position.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/popover-position.ts)
- [components/motion/preview-rail.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/preview-rail.tsx)
- [components/motion/select.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/select.tsx)
- [components/previews/agents/chat-preview.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/previews/agents/chat-preview.tsx)
- [lib/ease.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/ease.ts)
- [lib/favicon.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/favicon.ts)
- [lib/hooks/use-dismiss.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/hooks/use-dismiss.ts)
- [lib/hooks/use-favicon.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/hooks/use-favicon.ts)
- [lib/hooks/use-hover-capable.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/hooks/use-hover-capable.ts)
- [lib/hooks/use-hover-gesture.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/hooks/use-hover-gesture.ts)
- [lib/hooks/use-tap-gesture.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/hooks/use-tap-gesture.ts)
- [lib/portal.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/portal.tsx)
- [lib/touch.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/touch.ts)
- [lib/utils.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/utils.ts)
