Message Scroller
A chat transcript scroller for turn anchoring, follow-output while streaming, history prepend without jumps, and jump-to-message commands. Put it in a height-constrained parent — it fills available space.
Basic
Wrap each row in MessageScrollerItem. Mark turn starts with scrollAnchor.
Installation
CLI
Also needs
npx @sonojs/ui@latest add button && npm i lucide-reactComposition
structure
Usage
message-scroller.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| autoScroll | boolean | false | On `MessageScrollerProvider` — follow the live edge until the reader scrolls away. |
| defaultScrollPosition | "start" · "end" · "last-anchor" | "end" | Where a transcript opens on first paint. |
| scrollPreviousItemPeek | number | 48 | Pixels of the previous row kept visible above an anchor. |
| scrollAnchor | boolean | false | On `MessageScrollerItem` — mark the start of a turn. |
| messageId | string | — | Stable id for jump / visibility tracking. |
| direction | "start" · "end" | "end" | On `MessageScrollerButton` — vertical transcript edge to jump to (not writing direction). Row LTR/RTL comes from `Message` `align` + inherited `dir`. |