# MessageScroller

> A scroll container for a conversation.

- Category: [App & chat](https://tarve.dev/docs.md#chat)
- Import: `import { MessageScroller } from "@tarve/core";`
- Props type: `MessageScrollerProps`
- Source: [packages/core/src/chat-controls.ts:136](https://github.com/omarcosr/tarve/blob/main/packages/core/src/chat-controls.ts#L136)

## Usage

```tsx title="MessageScroller.tsx"
import { Message, MessageScroller, Text } from "@tarve/core";

<MessageScroller height={360} gap={12} style={{ width: 420 }}>
  {Array.from({ length: 20 }, (_, index) => (
    <Message key={index} side={index % 2 ? "outgoing" : "incoming"}>
      <Text>{index % 2 ? `Reply ${(index + 1) / 2}` : `Message ${index / 2 + 1}`}</Text>
    </Message>
  ))}
</MessageScroller>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `gap` | `number` | `12` |  |
| `height` | `number` | `360` |  |
| `onScroll` | `(offset: number, max: number, info: ScrollInfo) => void` | — |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="ScrollInfo"
interface ScrollInfo { source: ScrollSource }
```

Previous: [Bubble](https://tarve.dev/docs/components/Bubble.md) · Next: [Marker](https://tarve.dev/docs/components/Marker.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/MessageScroller · Index for agents: https://tarve.dev/llms.txt
