4.2.0
Core

MessageScroller

A scroll container for a live conversation that follows the newest message until a reader looks away, then hands back an explicit way to return.

A live stream

A message lands every 1.2 seconds. Scroll up while it runs: the scroller stops following, the jump control appears, and clicking it returns you to the live edge.

Scroll up while it streams
JS
You
Start the Q3 re-engagement import.
09:41
AC
Agent console
Reading northwind-q3.csv. 1,204 rows, 11 columns.
09:42
AC
Agent console
Mapped work_email to the dedupe key. 34 rows have none.
09:43
JS
You
Hold those, do not drop them.
09:44
AC
Agent console
Held 34 rows in the review queue.
09:45

Usage

import {
  MessageScroller,
  MessageScrollerButton,
  MessageScrollerContent,
  MessageScrollerItem,
  MessageScrollerProvider,
  MessageScrollerViewport,
  useMessageScroller,
  useMessageScrollerScrollable,
  useMessageScrollerVisibility,
} from '@oceanic-hub/brand-system'
<MessageScrollerProvider>
  <MessageScroller>
    <MessageScrollerViewport>
      <MessageScrollerContent>
        <MessageScrollerItem>…</MessageScrollerItem>
      </MessageScrollerContent>
    </MessageScrollerViewport>
    <MessageScrollerButton>…</MessageScrollerButton>
  </MessageScroller>
</MessageScrollerProvider>

Composition

Use the following composition to build a MessageScroller:

MessageScrollerProvider
└── MessageScroller
    ├── MessageScrollerViewport
    │   └── MessageScrollerContent
    │       └── MessageScrollerItem
    └── MessageScrollerButton

Part of the chat family, with Bubble and Message: this is the shell those two scroll inside, not a replacement for either. Reach for it wherever a conversation or a run log grows on its own while it is on screen — an agent console, a support thread, an import that is still writing lines — and a reader needs to be able to scroll up into history without being yanked back down by the next line arriving.

Upstream's page documents a much bigger component, and most of it is a written refusal. https://ui.shadcn.com/docs/components/radix/message-scroller ships from a separate package, @shadcn/react, and covers a full streaming-chat toolkit: anchoring a turn to a role as it is sent, opening a saved transcript at a chosen position, virtualizing thousands of messages, loading earlier history without moving the reader, jumping to an arbitrary message by command, a transcript outline that tracks the current turn, group-chat join markers, and per-message entrance animation. None of that is here. Two reasons, not one:

  • @shadcn/react declares peer react >= 19; this package declares >= 18. Taking the dependency would silently raise the floor for every consumer — a ledgered breaking change, not a lockfile bump.
  • The behaviour is unfalsifiable under this package's no-test-runner decision. Scroll physics needs a layout engine; scrollHeight and clientHeight are 0 under jsdom, so a test for ANY of the above would pass while proving nothing. Growing the surface would only grow the amount of untested behaviour resting on a human looking at a demo.

So what ships is the one behaviour small enough to own and prove that way: follow the live edge, stop the instant a reader scrolls away, offer an explicit way back. apps/showcase/examples/ message-scroller-demo.tsx is that proof, not an illustration of it. Scroll physics needs a layout engine and a jsdom-class runner has none, so this panel plus a human IS the guarantee.

MessageScrollerButton is the built-in way back, but it is not the only one — a surface with its own unread count or its own icon composes the same two hooks the built-in button does, shown in the second example: useMessageScrollerVisibility() for whether to show it, scrollToBottom off useMessageScroller for what it does. Do not key visibility on isAtBottom alone — a conversation short enough not to overflow is already at the bottom and has nothing to jump to.

A bespoke jump affordance

MessageScrollerButton is the built-in way back; a surface with its own unread count or its own icon composes the same two hooks it does — useMessageScrollerVisibility() for whether to show it, scrollToBottom off useMessageScroller for what it does. Do not key visibility on isAtBottom alone: a conversation short enough not to overflow is already at the bottom and has nothing to jump to.

Scroll up — only the control is custom, the scroller underneath is unchanged
Import 4181 started. Reading northwind-q3.csv.
1,204 rows, 11 columns detected.
34 rows have no usable dedupe key.
Held 34 rows in the review queue.
Merged 168 duplicates against existing contacts.
Created 1,002 contacts, updated 168.
Wrote 1,170 activity records to the timeline.
Second pass matched 21 of 34 on company domain.
13 rows remain with no usable key.
Assigned 13 rows to Marta Ruiz, due tomorrow 17:00.
Import 4181 closed. Duration 2m 14s, no errors.

API Reference

See the MessageScroller API page for every prop of every part, with types, defaults and the contract that pins them. It also documents useMessageScroller, useMessageScrollerScrollable and useMessageScrollerVisibility — exported alongside the parts, and signatures rather than props.

On this page